I am a rookie with this stuff and apologize in advance.. also I "borrowed" quite a bit of code for the HugoHurley project from aknip.. thanks!
Strategy is when renko bricks change direction for 2 bricks in a row a trade entry is initiated. Trade is closed out by the multicharts parabolic trailing stop. Sometimes a trigger to start a trade in the opposite direction before the previous trade is closed out thus missing that trade entry. What I want to add ,and have been unsuccessful at so far, is when a trade signal is given in opposite direction of a current ongoing trade I want to close out the existing ongoing trade and initiate the trade in the opposite direction. An added bonus would be the ability to add a trailing stop as well to the exit parameters. Any help with this would be greatly apprecited, thanks
Greg
Code is below
Inputs:
contractsize (2), // number of contracts
scalesize (2),
target ( 12 ), // target value in ticks
stoploss ( 12 ), // inital stoploss value in ticks
trailingstop ( 16 ), // trailing value in ticks (=max drawdown, if profit goes down this number of ticks,
// the position is automatically stopped out (intrabar)
maxdailyprofit(300), // Max profit (currency), after reaching this level trading will stop for this day
maxdailyloss(300), // Max loss (currency), after reaching this level trading will stop for this day
startTradeTime ( 3 ), // Start time for entry signals. Use 24h format: "3" means "3:00 AM", "14" means "2:00 PM"
durationTradeTime ( 9 ); // Duration time for entry signals, in hrs. Example: startTradeTime=9 and durationTradeTime=4
// means : Generate entry signals betwee 9:00 AM and 11:00 AM
Variables:
o1 ( 0 ),
o2 ( 0 ),
o3 ( 0 ),
c1 ( 0 ),
c2 ( 0 ),
c3 ( 0 ),
mp ( 0 ),
scale ( 0 );