I try to code a very simple multiple exit signal as below.
Try to exit part of the Long position every time price close below MA50.
The problem I have is that only the first time price close below MA50 will trigger a sell order.(see attached screenshot)
Also I set the POSITION LIMIT to 1,000,000 and ALLOW UP to 10 entry in signal property. So it shouldn't be a problem of executing those order.
Can someone let me know what's wrong with the code:
Code: Select all
If marketposition=0 and close > MALINE1 then buy 100000 contracts next bar at market;
if marketposition=1 and Close cross below MALINE2 then
sell 20000 contracts total next bar at MALINE2 LIMIT;