1, You need the "Date Time Function" plug in.
2. You are correct. You have to change OR5, OR15, OR30, and OR60 variables.
2 re "if(Interval() < 84600) {show_ACD = ParamToggle("ACD Bands
On/Off","Off|On");"
doesn't need changing.
On 3/20/08, spaceant888 <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Thanks for your sharing. Well I am totally new to AmiBroker.
>
> After I copied the indicator to Formula Editor and named it as ACD,
> then attach it to a chart. An error message comes up:
>
> Error 29:
> Variable 'markethours' used without having been initialized.
>
> How can I correct it? Am I missing an external DLL? If yes, where
> can I download it and where shoul I place?
>
> Secondly, the opening hours of the market that I want to apply the
> indicator is from 9:45 to 16:15 (morning session is 9:45-12:30;
> afternoon session is 14:30-16:15). I think I need to change the
> opening time to 9:45 (correspondingly for others like 93500 to
> 95000, etc). Do I need to change anything for the following?
>
> if(Interval() < 84600) {
> show_ACD = ParamToggle("ACD Bands On/Off","Off|On");
>
> Thanks!
>
> Sa
>
>
> --- In [email protected] <amibroker%40yahoogroups.com>, "Bill S"
> <[EMAIL PROTECTED]> wrote:
> >
> > MaxGraph=5;
> > GraphXSpace = 1;
> > // Start of variables used to calculate custom formulas
> > // Defines market hours
> > MarketOpen = 93000;
> > MarketClose = 161500;
> > MarketHours = deFlagTimeRange(MarketOpen, MarketClose);
> > FirstBarOfDay = deFlagFirstBarOfDay(MarketOpen);
> > LastBarOfDay = deFlagLastBarOfDay(MarketClose);
> > enumMarketHours = BarsSince(FirstBarOfDay);
> > // First 5 minutes of Opening Range
> > OR5High = deTimeRangeHHV(H,MarketOpen,93500);
> > OR5Low = deTimeRangeLLV(L,MarketOpen,93500);
> > OR5Median = (OR5High+OR5Low)/2;
> > // First 15 minutes of Opening Range
> > OR15High = deTimeRangeHHV(H,MarketOpen,94500);
> > OR15Low = deTimeRangeLLV(L,MarketOpen,94500);
> > OR15Median = (OR15High+OR15Low)/2;
> >
> > // First 30 minutes of Opening Range
> > OR30High = deTimeRangeHHV(H,MarketOpen,100000);
> > OR30Low = deTimeRangeLLV(L,MarketOpen,100000);
> >
> > // First 60 minutes of Opening Range
> > OR60High = deTimeRangeHHV(H,MarketOpen,103000);
> > OR60Low = deTimeRangeLLV(L,MarketOpen,103000);
> > // Yesterdays Daily values. Note: By adjusting Daysback to a
> greater
> > //value, all the calculations below will go back a number of
> > //corresponding days (ie: Daysback = 5 means 5 days ago)
> > DaysBack = 1;
> > YesterdaysHigh =
> > ValueWhen(Ref(deFlagLastBarOfDay(MarketClose),-1),deTimeRangeHHV
> (H,MarketOpen,MarketClose),DaysBack);
> > YesterdaysLow =
> > ValueWhen(Ref(deFlagLastBarOfDay(MarketClose),-1),deTimeRangeLLV
> (L,MarketOpen,MarketClose),DaysBack);
> > YesterdaysOpen = ValueWhen(deFlagLastBarOfDay
> (MarketOpen),O,DaysBack);
> > YesterdaysClose =
> > ValueWhen(Ref(deFlagLastBarOfDay(MarketClose),-1),C,DaysBack);
> > Yesterdays2HrHigh =
> > ValueWhen(Ref(LastBarOfDay,-1),deTimeRangeHHV
> (H,141500,161500),DaysBack);
> > Yesterdays2HrLow =
> > ValueWhen(Ref(LastBarOfDay,-1),deTimeRangeLLV
> (L,141500,161500),DaysBack);
> >
> > // Start of custom calculations & formulas
> > DailyPivot = (YesterdaysHigh+YesterdaysLow+YesterdaysClose)/3;
> > DailyMedian = (YesterdaysHigh+YesterdaysLow)/2;
> > DailyPivotHigh = DailyPivot + abs(DailyPivot - DailyMedian);
> > DailyPivotLow = DailyPivot - abs(DailyPivot - DailyMedian);
> > R1 = ((2 * DailyPivot) - YesterdaysLow);
> > S1 = ((2 * DailyPivot) - YesterdaysHigh);
> > R2 = ((DailyPivot - S1) + R1);
> > S2 = (DailyPivot - (R1 - S1));
> > R3 = (R2 + (YesterdaysHigh - YesterdaysLow));
> > S3 = (S2 - (YesterdaysHigh - YesterdaysLow));
> >
> > DayFilter =
> > deValueWhenTime((Sum(C>OR5Median,enumMarketHours)+Sum
> (O>OR5Median,enumMarketHours)+Sum(H>OR5Median,enumMarketHours)+Sum
> (L>OR5Median,enumMarketHours))/
> > 4,103000);
> > ACDHighOffset = ACDLowOffset = 0;
> > ACDHighOffset = ACDLowOffset = (OR15high - OR15low) * .50;
> > ACDHigh = OR15High + ACDHighOffset;
> > ACDLow = OR15Low - ACDLowOffset;
> > // Same variables as above, but plotting during after hours is
> suppressed
> > YestHighClean = IIf(MarketHours,YesterdaysHigh,Null);
> > YestLowClean = IIf(MarketHours,YesterdaysLow,Null);
> > YestCloseClean = IIf(MarketHours,YesterdaysOpen,Null);
> > YestCloseClean = IIf(MarketHours,YesterdaysClose,Null);
> > Y2HrHighClean = IIf(MarketHours,Yesterdays2HrHigh,Null);
> > Y2HrLowClean = IIf(MarketHours,Yesterdays2HrLow,Null);
> > DailyPivotClean = IIf(MarketHours,DailyPivot,Null);
> > DailyPivotHighClean = IIf(MarketHours,DailyPivotHigh,Null);
> > DailyPivotLowClean = IIf(MarketHours,DailyPivotlow,Null);
> > ACDHighClean = IIf(MarketHours,ACDHigh,Null);
> > ACDLowClean = IIf(MarketHours,ACDLow,Null);
> > OR5MedianClean = IIf(MarketHours,OR5Median,Null);
> > OR15MedianClean = IIf(MarketHours,OR15Median,Null);
> > OR15HighClean = IIf(MarketHours,OR15High,Null);
> > OR15LowClean = IIf(MarketHours,OR15Low,Null);
> > R1Clean = IIf(MarketHours,R1,Null);
> > S1Clean = IIf(MarketHours,S1,Null);
> > //R2Clean = IIf(MarketHours,R2,Null);
> > //S2Clean = IIf(MarketHours,S2,Null);
> >
> >
> > // Start of variables used to control color of bars/indicators
> > BullishBar = H > Ref(H,-1) AND L > Ref(L,-1);
> > BearishBar = H < Ref(H,-1) AND L < Ref(L,-1);
> > PriceColor =
> > IIf(deFlagTimeRange(MarketOpen,93500),colorWhite,IIf
> (deFlagTimeRange(93500,94500),colorLightBlue,IIf
> (MarketHours==False,colorDarkBlue,IIf(BullishBar,colorGreen,IIf
> (BearishBar,colorRed,colorLightGrey)))));
> > ORBarColor = IIf(deFlagTimeRange(93000,94500),0,colorOrange);
> > ORBarColor1 = IIf(deFlagTimeRange(93000,94500),0,colorBlue);
> > ORBarColor2 = IIf(deFlagTimeRange(93000,94500),0,colorYellow);
> > // Start of Plot() functions to display calculated series
> > //Plot(C,"C",PriceColor,styleBar+styleThick);
> > //PlotOHLC( Open, High, Low, Close, Name(), colorBlack,
> styleCandle);
> >
> > // Close
> > //Plot(EMA((O+H+L+C)/4,7),"EMA7",colorGreen,styleLine);
> > //Plot(EMA((O+H+L+C)/4,15),"EMA7",colorBlue,styleLine);
> > //Plot(OR5MedianClean,"5M",colorBlue,styleLine);
> > // Clayburg 5 Minute Mid Line
> > if(Interval() < 84600) {
> > show_ACD = ParamToggle("ACD Bands On/Off","Off|On");
> > if (show_ACD ) {
> > Plot(OR15MedianClean,"15M",ORbarcolor1,styleLine);
> > Plot(OR15HighClean,"15H",ORbarcolor2,styleLine);
> > Plot(OR15LowClean,"15L",ORbarcolor2,styleLine);
> > Plot(ACDHighClean,"ACDH",ORbarcolor,styleLine+styleThick);
> > // ACD High Threshold
> > Plot(ACDLowClean,"ACDL",ORbarcolor,styleLine+styleThick);
> > // ACD Low Threshold
> > //Plot(YestHighClean,"YH",colorLightGrey,styleLine+styleThick);
> > // Yesterdays High
> > //Plot(YestLowClean,"YL",colorLightGrey,styleLine+styleThick);
> > // Yesterdays Low
> > //Plot(DailyPivotClean,"PP",colorLightBlue,styleLine+styleThick);
> > // Pivot
> > //Plot(DailyPivotHighClean,"PH",colorPink,styleLine+styleThick);
> > // Pivot High
> > //Plot(DailyPivotLowClean,"PL",colorPink,styleLine+styleThick);
> > // Pivot Low
> > //Plot(R1Clean,"R1",colorRed,styleLine+styleThick);
> > // R1 Pivot
> > //Plot(S1Clean,"S1",colorRed,styleLine+styleThick);
> > // S1 Pivot
> > //Plot(Y2HrHighClean,"Y2H",colorBrightGreen,styleLine+styleThick);
> > // Yesterdays 2Hr High
> > //Plot(Y2HrLowClean,"Y2L",colorBrightGreen,styleLine+styleThick);
> > // Yesterdays 2Hr Low
> > //Plot(R2Clean,"R2",colorRed,styleLine+styleThick);
> > // R2 Pivot
> > //Plot(S2Clean,"S2",colorRed,styleLine+styleThick);
> > // S2 Pivot
> > // Plot color bands
> > //Plot(ACDLowClean,"ACDL",colorBlack,styleArea);
> > // ACD Low Threshold
> > //Plot(ACDHighClean,"ACDH",IIf(TimeNum()>=94500 AND
> > TimeNum()<=MarketClose,colorDarkGreen,colorBlack),styleArea);
> > // ACD High Threshold
> > }
> > }
> > //Title = "{{NAME}} - {{INTERVAL}} {{DATE}} - MyChart :
> {{VALUES}}";
> > Title = Name() + "-" + Interval(2) + " " + Date() + "\nOpen: "+O
> + ",
> > High:"+ H + ", Low: "+ L + ", Close: "+C ;//+ "\nACDH: " +
> > NumToStr(ACDHighClean,1.3) + ", ACDL: " + NumToStr
> (ACDLowClean,1.3);
> >
> > AUp = MarketHours AND Cross(C,ACDHigh);
> > ADn = MarketHours AND Cross(ACDLow,C);
> > //PlotShapes(shapeSmallUpTriangle * AUp,colorYellow,0,C-2);
> > //PlotShapes(shapeSmallDownTriangle * ADn,colorYellow,0,C+2);
> >
> > show_pp = ParamToggle("Pivot Points On/Off","Off|On");
> > if (show_pp ) {
> > Plot(R1,"",colorCustom11,styleLine);
> > Plot(S1,"",colorCustom11,styleLine);
> > Plot(R2,"",colorCustom12,styleLine);
> > Plot(S2,"",colorCustom12,styleLine);
> > Plot(R3,"",colorCustom13,styleLine);
> > Plot(S3,"",colorCustom13,styleLine);
> > Plot(DailyPivot,"",colorYellow,styleLine);
> > }
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> *********************************************************************
> ***
> >
> > On 3/20/08, spaceant888 <[EMAIL PROTECTED]> wrote:
> > >
> > > I'd be glad to know that as well. I just start to use AmiBroker
> and
> > > would like to test ACD breakout strategy to see the performance
> using
> > > Amibroker.
> > >
> > > Sa
> > >
> > > --- In [email protected]
> > > <amibroker%40yahoogroups.com><amibroker%40yahoogroups.com>,
> > > "enochbenjamin" <enochben@> wrote:
> > > >
> > > > I have searched the archives and see that this was circulated
> in the
> > > past, I was just wondering
> > > > if anybody has the afl code for the Mark Fisher ACD breakout
> strategy.
> > > >
> > > > Thanks in advance
> > > >
> > >
> > >
> > >
> >
>
>
>