Hi,
I tried to use the OpenPositionProtect strategy word to stop out of a Long position if the amount went > -80. It went right through -80 and kept falling. Does the language word understand a negative number ?
thanks
If MarketPosition= 1 and OpenPositionProfit < -80 then
begin
Buy ("SStopProtect") next bar at Market;
end;
Issue with OpenPositionProfit
-
- Posts: 173
- Joined: 25 Aug 2007
-
- Posts: 173
- Joined: 25 Aug 2007
- Marina Pashkova
- Posts: 2758
- Joined: 27 Jul 2007
Hi Thomas,
We have tested both codes below and both are working just just fine.
We have run tests on both scripts and they work as expected. As soon as we lose over 50, we exit at the next bar / tick (script 1).
As soon as we have made more than 50, we exit at the next bar / tick (script2).
Let me know how they work for you.
We have tested both codes below and both are working just just fine.
Code: Select all
// script1
buy next bar market;
If MarketPosition= 1 and OpenPositionProfit < -50 then
begin
Sell("LProtect") next bar at market ;
end;
// script2
buy next bar market;
If MarketPosition= 1 and OpenPositionProfit > 50 then
begin
Sell("LProtect") next bar at market ;
end;
As soon as we have made more than 50, we exit at the next bar / tick (script2).
Let me know how they work for you.