Hi,
I am struggling to manage to code for an average %profit out with multiple entries. At the moment i am using a code that needs position size and percentage at the close of bar to get out. In reverse the stop %loss works good for all positions but the multiple entries are only scaled out individualy. I see the PRT platform backtests the same as well, I am really sratchting my head over this.
Thanks
Wildbill
Do you need a percentage profit in money to get out of trades or a %profit of the current price from the average open price of the orders basket?
Hi Nicolas,
I am just looking for the %profit out at in comparison to the average entry price and not in money , so the code for example at the bottom of the strategy would be like……. set cumulative target %profit 0.5
Thanks
You can calculate yourself what percentage the price gain or loss in comparison with the average price of orders using the POSITIONPRICE instruction.
I am currently using the position price instruction to exit at all positions at a defined %. As the SET TARGET %PROFIT syntax will only exit the strategy in true % inside the bar with a single position. The use of positionprice only applies to close of bar and positions may not be exited even if the % threshold inside the bar, this because the close maybe different to the high or low of the bar. So maybe the question i should be asking is, can multiple positions be exited insde the bar in any form, ie. pips/£/%
Thanks
Yes, this behaviour is normal because of the not ‘inside bar’ look of Probacktest. The best you can do is to find the correct price level of the percentage of gain you’d like to get out of trades and then set a pending STOP order to close them all at once.
Of course, because of the same behaviour of the PRT backtest engine, your STOP order will only be tested and placed once per bar.
Well thats good to know and now i can stop banging head against the wall to find a solution. A work around has been to re code it all down to a lower timeframe but this has its own problems as well.
Many thanks Nicolas
Unless we got the multi timeframe support, this is the best you can do: lowering the timeframe used the most possible.