Buongiorno, vorrei sapere se è possibile effettuare ingressi a mercato calcolando il rapporto R/R in base a un numero di pips.
Ad esempio: desidero entrare con una posizione che rischi l’1% del mio capitale su uno stop di 5 pips, ed uscire quando il prezzo raggiunge il X%.
ecco!
DEFPARAM CumulateOrders = False
capital = 10000
riskpercent = 1
stoppoints = 5
targetR = 2
targetpoints = targetR * stoppoints
equity=capital+strategyprofit
moneyrisk = equity * riskpercent / 100
riskpercontract = stoppoints * POINTVALUE
qty = FLOOR(moneyrisk / riskpercontract)
qty = MAX(1, qty)
// --- Entry conditions (replace with your real signals)
conditionlong = close > open
conditionshort = close < open
IF NOT OnMarket THEN
IF conditionlong THEN
BUY qty CONTRACTS AT MARKET
ENDIF
IF conditionshort THEN
SELLSHORT qty CONTRACTS AT MARKET
ENDIF
ENDIF
set stop ploss stoppoints
set target pprofit targetpoints