Indicates whether there are short positions or not already open.
Syntax:
1 |
SHORTONMARKET |
Example :
1 2 3 4 5 6 |
myMACD = MACD[12,26,9](close) short = myMACD crosses under 0 IF NOT ShortOnMarket AND short THEN SELLSHORT 1 CONTRACTS AT MARKET ENDIF |
If i enter a short trade and then start an auto trade should ‘NOT SHORTONMARKET’ mean don’t enter an additional short trade?
IF c3 AND NOT SHORTONMARKET THEN
SELLSHORT 1 PERPOINT AT MARKET
ENDIF
IF SHORTONMARKET AND c4 THEN
EXITSHORT AT MARKET
‘NOT SHORTONMARKET’ means to know if we have currently or not a short order on the market. So you are right, we also used it to prevent to add additional order of the same type on market.
Thanks Nicolas, the above script worked on demo yesterday morning but has since failed, so i start with a manual short the auto trades in and i then have 2 shorts, when it exit trades im still in the manual short trade, any ideas why this may be happening?
Code do not interact with manual trades, that’s the reason.
ahh! thats a pity
I was under the impression If NOT SHORT ON MARKET meant “if we have not current short orders then do……” while if SHORT ON MARKET meant “If we have an open short then do…….”
Your assumption is right. In my example above, “short” is a variable that you can populate with any value, while “shortonmarket” if an instruction and this keyword is reserved.