Renko bars are very easy to work with, hence the logic of this strategy is simple:
1) Open long (2)
2) If the first bar into the trade is UP, sell (1)
3) If the second bar into the trade is UP, sell (1)
4) On any DOWN bar, exit trade.
This is the code:
CalculateOnBarClose = true; ... if([I]Conditions…[/I]) EnterLong(2); if ( Position.MarketPosition == MarketPosition.Long && Close[0] > Open[0] && BarsSinceEntry() == 0 ) ExitLong(1); if ( Position.MarketPosition == MarketPosition.Long && Close[0] > Open[0] && BarsSinceEntry() == 1 ) { ExitLong(1); BarColor = Color.Blue; } if ( Position.MarketPosition == MarketPosition.Long && Close[0] < Open[0] ) ExitLong();
Please see image. The trade on the left (2 up bars) is OK but the one on the right (up then down) is wrong - the first 'sell' price is a bar too low!
NT seems to have a problem placing trades on Renko charts in the right place.
I think the fundamental problem may be that two trades can't be entered on the same Renko bar!!!
Could my coding be wrong anywhere?
Any advice will be greatly appreciated.
Comment