Indicates the current average position price of the whole opened orders.
If you open 3 positions, respectively at 5$, 10$ and 15$, POSITIONPRICE is : (5+10+15)/3 = 10€.
Syntax :
POSITIONPRICE can also be used to get the previous average position price in the last candle period with offset :
|
//average position price of the previous candle (n-1) PositionPrice[1] |
Example :
Floating profit of the whole opened orders
|
//floating profit floatingprofit = (((close-positionprice)*pointvalue)*countofposition)/pipsize //actual trade gains |
Averaging down simple trading strategy example :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
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 //averaging down IF TRADEINDEX(1)>5 AND TRADEPRICE(1)-Close>20 AND LongOnMarket THEN BUY 1 CONTRACTS AT MARKET ENDIF //closing all positions when current close is superior of the average positions price IF COUNTOFPOSITION >= 2 AND Close > POSITIONPRICE THEN SELL AT MARKET ENDIF SET TARGET PROFIT 20 |