I am nearing the end of my strategy development and I would like to test the performance of the strategy by compounding all profits and placing subsequent orders accordingly.
I have created a double variable and I am adding all realized profits to this variable. I am then converting this double variable to Int and placing the Order(EnterLong only takes Int Values).
I am also diving my take profit targets into 4 parts. The issue is, that sometimes the strategy holds the remaining order size till close of session and I miss out on a lot of opportunities as a result. As an example,
say I have a total qty of 19546. Diving it in 4 equal parts of TP gives me 4886. The rounded 1 contract is left and the strategy holds on to it forever. How do I make it place all the remaining contracts on last TP or on the last stop loss?
tp1=ExitLongLimit(1,true,execution.Order.Filled/4,fib100,"MyTarget","My Entry");
tp2=ExitLongLimit(1,true,execution.Order.Filled/4,fib50,"MyTarget1","My Entry");
tp3=ExitLongLimit(1,true,execution.Order.Filled/4,fib618,"MyTarget2","My Entry");
tp4=ExitLongLimit(1,true,execution.Order.Filled/4,fib764,"MyTarget3","My Entry");
Thanks
Comment