Hi Dave, just started following, I think your videos are great and add a lot of value to the AB community, I have a quick question and maybe you could potentially make a video out of this. How are the ways that you use in order to prevent future leak, I know 1 way is to click on code check and profile, but there are instances that you still cant figure it out. I'll list some of the ones that I have encounters during my coding, 1 - when you buy at the open (or any other price before the close) and 1 of your conditions is C>o, or C>MA, or C>any price, 2 - When your buy price is the H of the day or L of the day. 3 - when you buy at for example yesterday's low (or any other price) and you forget to add the condition that the H or the L of the current day has to be above or below that entry price (usually when you forget about this, and it automatically enters at the L or H of the day. What are other instances that you have encountered that initially made the equity curve to the moon and then you realized that there was an error?
I Dave, just started following this particular code but when I try to back test it I got this msg: Missing short/cover variable assignment. How do I fix that?
Hi Dave. As I understood greater then ATR means greater than the average, while NR7 request last range to be narrower than every one of the last 6 ranges, not only the average of them. Right?
Yes, that's what I realized while I was listening to this. He's wrong. It's not supposed to be a range that's smaller than the average of the last seven days. It's supposed to be a range that is smaller than any range over the last seven days. Big difference. With his method, he's getting false signals. The code should be if range -1 (yesterday) is < range -2, and range -1 is < range -3, and range -1 < range -4... all the way up to range -8, and price today > high -1 (yesterday), then buy. He also didn't add brokerage costs, which are real, and inevitable.
thanks for the video guide. it helps a lot. i have a question if i want the Buyprice is just one tick above the high on very next bar, and if it price does not goes above the previous high on very next bar then signal will be cancelled .
+Lucky Benedict Balisi Hey Lucky, very true. To get around this, you can use an If Then Else statement (IIF) - off the top of my head it is something like: IF buy, THEN return the buyprice, ELSE return Null. A quick Google search should nail down the code format for you - I have a video on IIF as well :-) Cheers - Dave
+Maurice Petterlin Hey Maurice, that is awesome! Very nice - thank you. I ran some tests on that one, to expand on the example. Using this actual NR7 method, buying on the 7th day and using a Sell delay of 1 still, I get around 6% average annual return over the 50 years. The equity curve looks decent enough - a 45-ish degree angle, and the Maximum Drawdown is around 20%. I think it is less mainly because there are far fewer trades. With no Sell delay though, the results are (only just) negative. Very cool stuff, and very interesting. Thank you for the code!
+DaveASXWatch Great vids! I'm looking for 2 really helpful vids for Amibroker users-Have you got a video on how to protect your code with .DLL's ? Have you got a video on how to link to www.amibroker.com/at/ so you can forward test the strategies on a Interactive Brokers Simulation account - ibkb.interactivebrokers.com/node/663 Thanks Alex
Hi Dave, I don't think the code you provide is strictly correct. The NR7 is the smallest range of the last 7 bars which means that the last range is smaller than the previous 6 bars. www.tradingsetupsreview.com/nr7-trading-strategy/ Secondly you can't compare ATR(1) < ATR(7) because ATR(7) is the average true range of the last 7 bars so in effect it's the moving average of the last 7 true ranges. The code should be range = H-L; range < ref(range,-1) and range < ref(range,-2) and range < ref(range,-3) and range < ref(range,-4) and range < ref(range,-5) and range < ref(range,-6);
@@meigu01 No it is not a mistake. The condition for trade to be triggered is that market should trade at price higher than yesterday's high and if today's high is higher than previous day's high then it means that the trade has triggered because price went above yesterday's high. If he considered selling at today's high then it is completely wrong but else everything is correct except that ATR thing where he should have taken average of last 7 high minus low.
Seem to be pretty decent videos, nice job. A couple questions, 1. How do you then actually implement and trade a strategy you've made in Amibroker live with real money, otherwise what's the point? and 2. What data source are you using? Cheers!
As previously mentioned the use of ATR to determine the lowest 7 day range isn't ideal. Here's a better way to check if the current days range is the lowest of the past 7 days Range = H-L; LowestRange = Range == LLV(Range, 7);
DaveASXWatch. hi dave i'm a very big fan of your youtube channel.Many of your works had helped a lot for getting familiar with amibroker and technical analysis.Your video on ma crossover have helped me a lot for positional trading. but i'm concentrating on intraday trading and for that i need a small help from your side.i want to defined the initial trade entry time, final trade entry time and exit of all trades at a particular time in the day to your already existing ma optimization afl. So that i can get an intraday backtest report for 5 min,10 min etc..And i have been able to define the timings for ma crossover strategy but with out the optimization.so please help to define the timings for optimized ma afl. and i will post the afl that i have defined the timings for ema crossover strategy.i hope this will help to some extent. _ section begin(ema crossover strategy with defined timings); SetBarsRequired(100000,0); GraphXSpace = 15; SetChartOptions(0,chartShowArrows|chartShowDates); SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0))); GfxSetBkMode(0); GfxSetOverlayMode(1); SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(CO,ParamColor("Wick UP Color", colorDarkGreen),IIf(C= FirstTradeTime AND TimeNum() = ExitAllPositionsTime; Buy=ExRem(Buy,Sell) ; Sell=ExRem(Sell,Buy); Short=Sell AND (TimeNum() >= FirstTradeTime AND TimeNum() = ExitAllPositionsTime; BuyPrice=ValueWhen(Buy,C); SellPrice=ValueWhen(Sell,C); ShortPrice=ValueWhen(Short,C); CoverPrice=ValueWhen(Cover,C); Plot( EMA( P, per1 ), "EMA1", ParamColor( "Color1", colorCycle ), ParamStyle("Style") ); Plot( EMA( P, per2 ), "EMA2", ParamColor( "Color2", colorCycle ), ParamStyle("Style") ); PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40); PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50); PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45); PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40); PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50); PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45); PlotShapes(IIf(TimeNum() >= ExitAllPositionsTime,5,-1e10),colorGreen,0 ,H,5); PlotShapes(IIf(TimeNum() >= ExitAllPositionsTime,6,-1e10),colorRed,0,L,5); _section end();
Where is Dave going? not uploading videos in the last 5 years? RIP?
Hi Dave, just started following, I think your videos are great and add a lot of value to the AB community, I have a quick question and maybe you could potentially make a video out of this. How are the ways that you use in order to prevent future leak, I know 1 way is to click on code check and profile, but there are instances that you still cant figure it out. I'll list some of the ones that I have encounters during my coding, 1 - when you buy at the open (or any other price before the close) and 1 of your conditions is C>o, or C>MA, or C>any price, 2 - When your buy price is the H of the day or L of the day. 3 - when you buy at for example yesterday's low (or any other price) and you forget to add the condition that the H or the L of the current day has to be above or below that entry price (usually when you forget about this, and it automatically enters at the L or H of the day. What are other instances that you have encountered that initially made the equity curve to the moon and then you realized that there was an error?
Super awesome! Thank you for your sharing. From Thailand.
I Dave, just started following this particular code but when I try to back test it I got this msg: Missing short/cover variable assignment. How do I fix that?
before market close, how do you know today’s High?
You dont know. But you put a stop limit order. It todays high dont reach yesterday high you are not buying
Hi Dave. As I understood greater then ATR means greater than the average, while NR7 request last range to be narrower than every one of the last 6 ranges, not only the average of them. Right?
Yes, that's what I realized while I was listening to this. He's wrong. It's not supposed to be a range that's smaller than the average of the last seven days. It's supposed to be a range that is smaller than any range over the last seven days. Big difference. With his method, he's getting false signals. The code should be if range -1 (yesterday) is < range -2, and range -1 is < range -3, and range -1 < range -4... all the way up to range -8, and price today > high -1 (yesterday), then buy. He also didn't add brokerage costs, which are real, and inevitable.
thanks for the video guide. it helps a lot. i have a question if i want the Buyprice is just one tick above the high on very next bar, and if it price does not goes above the previous high on very next bar then signal will be cancelled .
Hi Dave, theres a problem with the last line of codes you added to plot the buy price. They appear on every bars.
+Lucky Benedict Balisi Hey Lucky, very true. To get around this, you can use an If Then Else statement (IIF) - off the top of my head it is something like: IF buy, THEN return the buyprice, ELSE return Null. A quick Google search should nail down the code format for you - I have a video on IIF as well :-) Cheers - Dave
Thank you!
+Maurice Petterlin Hey Maurice, that is awesome! Very nice - thank you.
I ran some tests on that one, to expand on the example. Using this actual NR7 method, buying on the 7th day and using a Sell delay of 1 still, I get around 6% average annual return over the 50 years. The equity curve looks decent enough - a 45-ish degree angle, and the Maximum Drawdown is around 20%. I think it is less mainly because there are far fewer trades. With no Sell delay though, the results are (only just) negative.
Very cool stuff, and very interesting. Thank you for the code!
+DaveASXWatch Great vids!
I'm looking for 2 really helpful vids for Amibroker users-Have you got a video on how to protect your code with .DLL's ?
Have you got a video on how to link to www.amibroker.com/at/ so you can forward test the strategies on a Interactive Brokers Simulation account - ibkb.interactivebrokers.com/node/663
Thanks Alex
So why did you add the slippage ?
Hi Dave, I don't think the code you provide is strictly correct. The NR7 is the smallest range of the last 7 bars which means that the last range is smaller than the previous 6 bars. www.tradingsetupsreview.com/nr7-trading-strategy/
Secondly you can't compare ATR(1) < ATR(7) because ATR(7) is the average true range of the last 7 bars so in effect it's the moving average of the last 7 true ranges. The code should be
range = H-L;
range < ref(range,-1) and range < ref(range,-2) and range < ref(range,-3) and range < ref(range,-4) and range < ref(range,-5) and range < ref(range,-6);
Another mistake is that today’s high could not be determined before market close.
@@meigu01 No it is not a mistake. The condition for trade to be triggered is that market should trade at price higher than yesterday's high and if today's high is higher than previous day's high then it means that the trade has triggered because price went above yesterday's high. If he considered selling at today's high then it is completely wrong but else everything is correct except that ATR thing where he should have taken average of last 7 high minus low.
tnx for the video, but what is close condition? I want to code it for mt4.
Thank you
Can we have Open Interest Charts in Amibroker
could you teach how to code Pattern explorer in Amibroker,please?
Seem to be pretty decent videos, nice job. A couple questions, 1. How do you then actually implement and trade a strategy you've made in Amibroker live with real money, otherwise what's the point? and 2. What data source are you using? Cheers!
Hey mate sounds to easy is this for long only
Awsome video ! Thanks for sharing ! Anybody tried to code it in mt4 for the FOREX market ?
As previously mentioned the use of ATR to determine the lowest 7 day range isn't ideal.
Here's a better way to check if the current days range is the lowest of the past 7 days
Range = H-L;
LowestRange = Range == LLV(Range, 7);
I love how clean this code is, thank you!
DaveASXWatch. hi dave i'm a very big fan of your youtube channel.Many of your works had helped a lot for getting familiar with amibroker and technical analysis.Your video on ma crossover have helped me a lot for positional trading. but i'm concentrating on intraday trading and for that i need a small help from your side.i want to defined the initial trade entry time, final trade entry time and exit of all trades at a particular time in the day to your already existing ma optimization afl. So that i can get an intraday backtest report for 5 min,10 min etc..And i have been able to define the timings for ma crossover strategy but with out the optimization.so please help to define the timings for optimized ma afl. and i will post the afl that i have defined the timings for ema crossover strategy.i hope this will help to some extent.
_ section begin(ema crossover strategy with defined timings);
SetBarsRequired(100000,0);
GraphXSpace = 15;
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("bkcolor",ColorRGB(0,0, 0)));
GfxSetBkMode(0);
GfxSetOverlayMode(1);
SetBarFillColor(IIf(C>O,ParamColor("Candle UP Color", colorGreen),IIf(CO,ParamColor("Wick UP Color", colorDarkGreen),IIf(C= FirstTradeTime AND TimeNum() = ExitAllPositionsTime;
Buy=ExRem(Buy,Sell) ;
Sell=ExRem(Sell,Buy);
Short=Sell AND (TimeNum() >= FirstTradeTime AND TimeNum() = ExitAllPositionsTime;
BuyPrice=ValueWhen(Buy,C);
SellPrice=ValueWhen(Sell,C);
ShortPrice=ValueWhen(Short,C);
CoverPrice=ValueWhen(Cover,C);
Plot( EMA( P, per1 ), "EMA1", ParamColor( "Color1", colorCycle ), ParamStyle("Style") );
Plot( EMA( P, per2 ), "EMA2", ParamColor( "Color2", colorCycle ), ParamStyle("Style") );
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
PlotShapes(IIf(TimeNum() >= ExitAllPositionsTime,5,-1e10),colorGreen,0 ,H,5);
PlotShapes(IIf(TimeNum() >= ExitAllPositionsTime,6,-1e10),colorRed,0,L,5);
_section end();