Hi,
I have converted the BuyZone & SellZone indicator for Amibroker.
Drag and drop the indicator onto the chart. Right click to alter parameters:
TimeOfOpen: This is the time of open on the chart. 130000 = 13:00; 143000 = 14:30; 184300 = 18:43, etc...
BuyZonePointsAway: The number of points or pips the zones are away from the Open price. For example, 3 pips for FX, or 10 points for AAPL.
Multiplier: Use these values:
10000 = GBP:USD
100 = Stocks
(Multiplier tells Amibroker how many decimal places there are for this chart.
For example, AAPL: $110.80  so multiplier is 100.
GBP:USD: 1.9000  so multiplier is 10000
GBP:JPY: 240.10  so multiplier is 100).
Off/Open/Open + zones: Ranges from 02. Just alternates the plotting of lines  a graphical display function only
Blue line = Open
Two dotted orange lines are the zones
Enjoy!
Cheers  Alex
PS Oh, if anyone can help convert DynamicS/R, that would be great!!!
BuyZone indicator for Amibroker
Moderator: moderators

 rank: 50+ posts
 Posts: 79
 Joined: Wed Nov 08, 2006 4:46 pm
 Reputation: 0
 Gender:
BuyZone indicator for Amibroker
 Attachments

 BuyZone.txt
 (1.2 KiB) Downloaded 298 times
Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.
Thank you for your support.
I may be missing something, but if I understand the simple "english" translation of the TS code, then the AB code might be...
//DynamicSR
iPeriods = Param("iPeriods",25 ,1, 100,1);
Dynamic_R = HHV(H,iPeriods);
Dynamic_S = LLV(L,iPeriods);
Dynamic_R = IIf(H >= Dynamic_R, H, Dynamic_R);
Dynamic_S = IIf(H <= Dynamic_S ,L,Dynamic_S);
DynamicRange = Dynamic_R  Dynamic_S;
fib1 = Dynamic_S + .24 * DynamicRange;
fib2 = Dynamic_S + .38 * DynamicRange;
fib3 = Dynamic_S + .50 * DynamicRange;
fib4 = Dynamic_S + .62 * DynamicRange;
fib5 = Dynamic_S + .76 * DynamicRange;
Plot(C,"",colorGreen,64);
Plot(Dynamic_R,"DR",colorRed,1);
Plot(Dynamic_S,"DS",colorBlue,1);
Plot(fib1,"F1", colorPaleGreen,1styleDashed);
Plot(fib2,"F2", colorBrown,1styleDashed);
Plot(fib3,"F3", colorGrey40,1styleDashed);
Plot(fib4,"F4", colorDarkYellow,1styleDashed);
Plot(fib5,"F5", colorDefault,1styleDashed);
//DynamicSR
iPeriods = Param("iPeriods",25 ,1, 100,1);
Dynamic_R = HHV(H,iPeriods);
Dynamic_S = LLV(L,iPeriods);
Dynamic_R = IIf(H >= Dynamic_R, H, Dynamic_R);
Dynamic_S = IIf(H <= Dynamic_S ,L,Dynamic_S);
DynamicRange = Dynamic_R  Dynamic_S;
fib1 = Dynamic_S + .24 * DynamicRange;
fib2 = Dynamic_S + .38 * DynamicRange;
fib3 = Dynamic_S + .50 * DynamicRange;
fib4 = Dynamic_S + .62 * DynamicRange;
fib5 = Dynamic_S + .76 * DynamicRange;
Plot(C,"",colorGreen,64);
Plot(Dynamic_R,"DR",colorRed,1);
Plot(Dynamic_S,"DS",colorBlue,1);
Plot(fib1,"F1", colorPaleGreen,1styleDashed);
Plot(fib2,"F2", colorBrown,1styleDashed);
Plot(fib3,"F3", colorGrey40,1styleDashed);
Plot(fib4,"F4", colorDarkYellow,1styleDashed);
Plot(fib5,"F5", colorDefault,1styleDashed);

 rank: 50+ posts
 Posts: 79
 Joined: Wed Nov 08, 2006 4:46 pm
 Reputation: 0
 Gender:
I have amended the DynamicSR indicator code below, as I don't think it was calculating correctly.
If anyone else could test this, that would be great!
[hr]
iPeriods = Param("iPeriods",5 ,1, 100,1); // 5 is what Avery recommends
dofibs = Param("PlotFibs",0,0,1,1);
Dynamic_R = HHV(H,iPeriods);
Dynamic_S = LLV(L,iPeriods);
DynamicRange = Dynamic_R  Dynamic_S;
fib1 = Dynamic_S + .24 * DynamicRange;
fib2 = Dynamic_S + .38 * DynamicRange;
fib3 = Dynamic_S + .50 * DynamicRange;
fib4 = Dynamic_S + .62 * DynamicRange;
fib5 = Dynamic_S + .76 * DynamicRange;
Plot(Dynamic_R,"DR",colorRed,styleDots);
Plot(Dynamic_S,"DS",colorBlue,styleDots);
if (doFibs==1)
{
Plot(fib1,"F1", colorPaleGreen,1styleDashed);
Plot(fib2,"F2", colorBrown,1styleDashed);
Plot(fib3,"F3", colorGrey40,1styleDashed);
Plot(fib4,"F4", colorDarkYellow,1styleDashed);
Plot(fib5,"F5", colorDefault,1styleDashed);
}
If anyone else could test this, that would be great!
[hr]
iPeriods = Param("iPeriods",5 ,1, 100,1); // 5 is what Avery recommends
dofibs = Param("PlotFibs",0,0,1,1);
Dynamic_R = HHV(H,iPeriods);
Dynamic_S = LLV(L,iPeriods);
DynamicRange = Dynamic_R  Dynamic_S;
fib1 = Dynamic_S + .24 * DynamicRange;
fib2 = Dynamic_S + .38 * DynamicRange;
fib3 = Dynamic_S + .50 * DynamicRange;
fib4 = Dynamic_S + .62 * DynamicRange;
fib5 = Dynamic_S + .76 * DynamicRange;
Plot(Dynamic_R,"DR",colorRed,styleDots);
Plot(Dynamic_S,"DS",colorBlue,styleDots);
if (doFibs==1)
{
Plot(fib1,"F1", colorPaleGreen,1styleDashed);
Plot(fib2,"F2", colorBrown,1styleDashed);
Plot(fib3,"F3", colorGrey40,1styleDashed);
Plot(fib4,"F4", colorDarkYellow,1styleDashed);
Plot(fib5,"F5", colorDefault,1styleDashed);
}
Your code seems to work fine.
Seemed sensible to make the support and resistance apply only to the day in question  otherwise the first iPeriod number of bars are distorted by the previous day's bars (especially if there was a significant gap).
I haven't looked at the TS code, so not sure if this matches Avery's strategy.
Code is below. (I disabled a couple of the fib lines just to reduce clutter on the screen.)
Haven't paper traded or backtested this strategy yet  what's your results been like for either??
Vino
//DynamicSR
iPeriods = Param("iPeriods",5 ,1, 100,1);
SameDay = Day()  Ref(Day(), 1); // True if current bar is on same day as previous bar
BarsSinceOpen = BarsSince(SameDay);
PeriodToUse = IIf (BarsSinceOpen < iPeriods, BarsSinceOpen + 1, iPeriods);
Dynamic_R = HHV(H,PeriodToUse);
Dynamic_S = LLV(L,PeriodToUse);
Dynamic_R = IIf(H >= Dynamic_R, H, Dynamic_R);
Dynamic_S = IIf(H <= Dynamic_S ,L,Dynamic_S);
DynamicRange = Dynamic_R  Dynamic_S;
fib1 = Dynamic_S + .24 * DynamicRange;
// fib2 = Dynamic_S + .38 * DynamicRange;
fib3 = Dynamic_S + .50 * DynamicRange;
// fib4 = Dynamic_S + .62 * DynamicRange;
fib5 = Dynamic_S + .76 * DynamicRange;
Plot(Dynamic_R,"DR",colorRed,styleDots);
Plot(Dynamic_S,"DS",colorBlue,styleDots);
Plot(fib1,"F1", colorPaleGreen,1styleDashed);
// Plot(fib2,"F2", colorBrown,1styleDashed);
Plot(fib3,"F3", colorGrey40,1styleDashed);
// Plot(fib4,"F4", colorDarkYellow,1styleDashed);
Plot(fib5,"F5", colorPaleGreen,1styleDashed);
Seemed sensible to make the support and resistance apply only to the day in question  otherwise the first iPeriod number of bars are distorted by the previous day's bars (especially if there was a significant gap).
I haven't looked at the TS code, so not sure if this matches Avery's strategy.
Code is below. (I disabled a couple of the fib lines just to reduce clutter on the screen.)
Haven't paper traded or backtested this strategy yet  what's your results been like for either??
Vino
//DynamicSR
iPeriods = Param("iPeriods",5 ,1, 100,1);
SameDay = Day()  Ref(Day(), 1); // True if current bar is on same day as previous bar
BarsSinceOpen = BarsSince(SameDay);
PeriodToUse = IIf (BarsSinceOpen < iPeriods, BarsSinceOpen + 1, iPeriods);
Dynamic_R = HHV(H,PeriodToUse);
Dynamic_S = LLV(L,PeriodToUse);
Dynamic_R = IIf(H >= Dynamic_R, H, Dynamic_R);
Dynamic_S = IIf(H <= Dynamic_S ,L,Dynamic_S);
DynamicRange = Dynamic_R  Dynamic_S;
fib1 = Dynamic_S + .24 * DynamicRange;
// fib2 = Dynamic_S + .38 * DynamicRange;
fib3 = Dynamic_S + .50 * DynamicRange;
// fib4 = Dynamic_S + .62 * DynamicRange;
fib5 = Dynamic_S + .76 * DynamicRange;
Plot(Dynamic_R,"DR",colorRed,styleDots);
Plot(Dynamic_S,"DS",colorBlue,styleDots);
Plot(fib1,"F1", colorPaleGreen,1styleDashed);
// Plot(fib2,"F2", colorBrown,1styleDashed);
Plot(fib3,"F3", colorGrey40,1styleDashed);
// Plot(fib4,"F4", colorDarkYellow,1styleDashed);
Plot(fib5,"F5", colorPaleGreen,1styleDashed);
Never code late at night!
This version corrects the error I made in the previous version.
//DynamicSR
iPeriods = Param("iPeriods",5 ,1, 100,1);
DayValue = Day();
NewDay[0] = 1;
for( i = 1; i < BarCount; i++)
{
if (DayValue[i] == DayValue[i1])
NewDay[i] = 0;
else
NewDay[i] = 1;
}
BarsSinceOpen = BarsSince(NewDay);
PeriodToUse = IIf (BarsSinceOpen < iPeriods, BarsSinceOpen + 1, iPeriods);
Dynamic_R = HHV(H,PeriodToUse);
Dynamic_S = LLV(L,PeriodToUse);
Dynamic_R = IIf(H >= Dynamic_R, H, Dynamic_R);
Dynamic_S = IIf(H <= Dynamic_S ,L,Dynamic_S);
DynamicRange = Dynamic_R  Dynamic_S;
fib1 = Dynamic_S + .24 * DynamicRange;
// fib2 = Dynamic_S + .38 * DynamicRange;
fib3 = Dynamic_S + .50 * DynamicRange;
// fib4 = Dynamic_S + .62 * DynamicRange;
fib5 = Dynamic_S + .76 * DynamicRange;
Plot(Dynamic_R,"DR",colorRed,styleDots);
Plot(Dynamic_S,"DS",colorBlue,styleDots);
Plot(fib1,"F1", colorPaleGreen,1styleDashed);
// Plot(fib2,"F2", colorBrown,1styleDashed);
Plot(fib3,"F3", colorGrey40,1styleDashed);
// Plot(fib4,"F4", colorDarkYellow,1styleDashed);
Plot(fib5,"F5", colorPaleGreen,1styleDashed);
This version corrects the error I made in the previous version.
//DynamicSR
iPeriods = Param("iPeriods",5 ,1, 100,1);
DayValue = Day();
NewDay[0] = 1;
for( i = 1; i < BarCount; i++)
{
if (DayValue[i] == DayValue[i1])
NewDay[i] = 0;
else
NewDay[i] = 1;
}
BarsSinceOpen = BarsSince(NewDay);
PeriodToUse = IIf (BarsSinceOpen < iPeriods, BarsSinceOpen + 1, iPeriods);
Dynamic_R = HHV(H,PeriodToUse);
Dynamic_S = LLV(L,PeriodToUse);
Dynamic_R = IIf(H >= Dynamic_R, H, Dynamic_R);
Dynamic_S = IIf(H <= Dynamic_S ,L,Dynamic_S);
DynamicRange = Dynamic_R  Dynamic_S;
fib1 = Dynamic_S + .24 * DynamicRange;
// fib2 = Dynamic_S + .38 * DynamicRange;
fib3 = Dynamic_S + .50 * DynamicRange;
// fib4 = Dynamic_S + .62 * DynamicRange;
fib5 = Dynamic_S + .76 * DynamicRange;
Plot(Dynamic_R,"DR",colorRed,styleDots);
Plot(Dynamic_S,"DS",colorBlue,styleDots);
Plot(fib1,"F1", colorPaleGreen,1styleDashed);
// Plot(fib2,"F2", colorBrown,1styleDashed);
Plot(fib3,"F3", colorGrey40,1styleDashed);
// Plot(fib4,"F4", colorDarkYellow,1styleDashed);
Plot(fib5,"F5", colorPaleGreen,1styleDashed);
Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.
Thank you for your support.
BuyZone, Dynamic SR, Fibs, and Slot Machine
I've taken the code from this thread (thanks to alex, ricko and vino) and have combined them into a single AFL. I've also added the slot machine functionality. The code seems to work well with the YM, but I have not tested it with Forex. More information is in the code.
Regards,
David
 Attachments

 TRO Indicators.txt
 TRO indicators for AmiBroker: BuyZone, Dynamic SR, Fibs, and Slot Machine. The filename is renamed to .txt because the forum software will not allow a .afl file to be uploaded.
 (6.47 KiB) Downloaded 242 times
Dynamic SR multitimeframe
I updated the Dynamic SR code to allow a user specified timeframe for the Dynamic SR and Fibs instead of using the chart timeframe. This allows displaying chart timeframes smaller than the Dynamic SR timeframe. For example, the 1 minute YM chart below (Chart 1) shows a 5 minute Dynamic SR. Every 5 price bars is a single Dynamic SR bar, thus 5 SR dots are displayed for each Dynamic SR value. This allows you to drill down inside a Dynamic SR bar and see how price moved within the bar (assuming you have the more detailed data).
Chart 1
I also added a line plot of the high and low of the Dynamic SR price bars. This makes it easier to see how the price chart timeframe bars move within the Dynamic SR timeframe bars. This can be turned on/off and is shown in the Chart 2 below.
Chart 2
Attached is the AmiBroker code. I hope someone finds it useful.
Regards,
David
Chart 1
I also added a line plot of the high and low of the Dynamic SR price bars. This makes it easier to see how the price chart timeframe bars move within the Dynamic SR timeframe bars. This can be turned on/off and is shown in the Chart 2 below.
Chart 2
Attached is the AmiBroker code. I hope someone finds it useful.
Regards,
David
 Attachments

 TRO Indicators2.txt
 Udated AmiBroker TRO indicators with user defined Dynamic SR timeframe.
 (7.75 KiB) Downloaded 241 times
Good work. I will find this code useful.
You have inherited an error. To plot the Support line properly, I think anyone using this should change the following line of code:
Dynamic_S = IIf(H <= Dynamic_S ,L,Dynamic_S);
to
Dynamic_S = IIf(L <= Dynamic_S ,L,Dynamic_S);
Now I've seen how to do the slot machine indicators, its obvious. Thanks.
Vino
You have inherited an error. To plot the Support line properly, I think anyone using this should change the following line of code:
Dynamic_S = IIf(H <= Dynamic_S ,L,Dynamic_S);
to
Dynamic_S = IIf(L <= Dynamic_S ,L,Dynamic_S);
Now I've seen how to do the slot machine indicators, its obvious. Thanks.
Vino
Thanks Vino. I had assumed the dynamic SR code I took from this thread worked correctly. I had been working with the code for a couple of days and didn't notice any problems with the support plots.
The slot machine is my own interpretation. Sometimes it's just easier to write an indicator by understanding what it needs to do. I had taken a look at the eSignal code but there was so much eSignal overhead that the indicator logic is hard to find in all the code (at least it is for someone who doesn't know the eSignal language...).
Regards,
David
The slot machine is my own interpretation. Sometimes it's just easier to write an indicator by understanding what it needs to do. I had taken a look at the eSignal code but there was so much eSignal overhead that the indicator logic is hard to find in all the code (at least it is for someone who doesn't know the eSignal language...).
Regards,
David
After working with the user defined timeframe Dynamic SR indictor display for a while, I came to realize that they were shifted one timeframe bar to the left. I've attached an update with the fix.
Regards,
David
Regards,
David
 Attachments

 TRO Iindicators2b.txt
 Dynamic SR display fix.
 (8.09 KiB) Downloaded 272 times
Please add www.kreslik.com to your ad blocker white list.
Thank you for your support.
Thank you for your support.