Counts the number of open long shares or lots.
Syntax:
1 |
COUNTOFLONGSHARES |
Example :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
myMACD = MACD[12,26,9](close) long = myMACD crosses over 0 //first order IF NOT LongOnMarket AND long THEN BUY 1 CONTRACTS AT MARKET ENDIF MAXSHARES = COUNTOFLONGSHARES <= 3 //let's add another order while price continue to get higher (more than 10 points) than the last order taken with a condition of 5 bars elapsed since then IF TRADEINDEX(1)>5 AND Close-TRADEPRICE(1)>10 AND LongOnMarket AND MAXSHARES THEN BUY 1 CONTRACTS AT MARKET ENDIF SET STOP TRAILING 50 |