nothingness99
New member
Hi,
Can anyone help me code this
I initially had a long position opened with the condition totalscore[0]>0
Now I am only interested to see the closing signal which is totalscore[0]<0
How do I write the code to instruct TOS to skip the long buying order while I had the long position in place? And once the long position is closed how do I instruct it to open a new sell position with the same signal at the same time? I tried following the commands but it skipped my sell-to-open order:
AddOrder(OrderType.BUY_TO_OPEN, totalscore[0]>0 within 1 bars, close, 100, name = "", arrowColor = Color.GREEN);
AddOrder(OrderType.Sell_TO_close, totalscore[0]<0 within 1 bars, close, 100, name = "", arrowColor = Color.red);
#AddOrder(OrderType.sell_TO_OPEN, totalscore[0]<0 within 1 bars, close, 100, name = "", arrowColor = Color.dark_red);
#AddOrder(OrderType.buy_TO_close, totalscore[0]>0 within 1 bars, close, 100, name = "", arrowColor = Color.dark_green);
Thanks in advance.
Can anyone help me code this
I initially had a long position opened with the condition totalscore[0]>0
Now I am only interested to see the closing signal which is totalscore[0]<0
How do I write the code to instruct TOS to skip the long buying order while I had the long position in place? And once the long position is closed how do I instruct it to open a new sell position with the same signal at the same time? I tried following the commands but it skipped my sell-to-open order:
AddOrder(OrderType.BUY_TO_OPEN, totalscore[0]>0 within 1 bars, close, 100, name = "", arrowColor = Color.GREEN);
AddOrder(OrderType.Sell_TO_close, totalscore[0]<0 within 1 bars, close, 100, name = "", arrowColor = Color.red);
#AddOrder(OrderType.sell_TO_OPEN, totalscore[0]<0 within 1 bars, close, 100, name = "", arrowColor = Color.dark_red);
#AddOrder(OrderType.buy_TO_close, totalscore[0]>0 within 1 bars, close, 100, name = "", arrowColor = Color.dark_green);
Thanks in advance.