Hello..
I would like my system to close all my open positions at the same time once the total is = X pips or X USD ..
so for example my algo opens up at position then another at after -15 pips then another one at -30 pips = 3 open positions.
When the total of these 3 are equal to X amount of pips profit // or USD i want them to close. How do i code this?
Thanks
Hi Marcus,
I use a piece of code that will close all my positions (long or short) when the price is above the average (positionprice):
For example, if you have 4 LONG positions open, and the average price is becoming positive, then you can close them at market. The extrapip is the amount of pips you want to be positive (x number of contracts). If you want a conservative approach, you can set extrapip=0
extrapip=10
IF LONGONMARKET AND countoflongshares=4 AND close>(positionprice+extrapips*pipsize) THEN
SELL AT MARKET
ENDIF
This only works with EITHER long or short. As you know PRT doesn’t allow you to open long and short (hedging) positions at the same time, in the same strategy
Regards,
Topic moved to ProOrder forum as it is auto strategy related. Please try to post in the correct forum with future posts.