hello apprentice
could you code this PRT code for TS.
Defparam cumulateorders = false // no accumulation of positionsDefparam
preloadbars = 3000//
POSITIONS SIZE
n = 1
//PARAMÈTRES
// The higher the "ratio", the fewer positions there are
ratio = 0.64
// HOURS
startTime = 210000
endTime = 231500
exitLongTime = 200000
exitShortTime = 80000
// INDICATEUR MOMENTUM
OTa = Momentum[26]
c1a = OTa > OTa[11]
MLTa = Momentum[280]
c2a = MLTa > MLTa[20
]OTv = Momentum[4
]c1v = OTv < OTv[5]
MLTv = Momentum[180]
c2v = MLTv < MLTv[40]
CONDBUY = c1a and c2a
CONDSELL = c1v and c2v
// STOP LOSS & TAKE PROFIT (%)
SL = 1
TP = 0.8
Period = 12
// CANDLE REFERENCE to StartTime
if time = startTime THEN
amplitude = highest[Period](high) - lowest[Period](low)
ouverture = close
endif
// LONGS & SHORTS :every day except Friday // between StartTime and EndTime iftime>=startTimeandtime<=endTimeanddayOfWeek<>5
and dayofweek<> 0 and CONDBUY then
buy n contract at ouverture - amplitude*ratio limit
endif
iftime>=startTimeandtime<=endTimeanddayOfWeek<>5
and dayofweek<> 0 and CONDSELL then
sellshort n contract at ouverture + amplitude*ratio limit
endif
// Stop Loss & Take Profit
set stop %loss SLset
target %profit TP
// Exit Time
if time = exitLongTime then
sell at market
endif
if time = exitShortTime then
exitshort at market
endif
The exhibits are taken between 21H and 23:15 (hence the name "EndofDay"), but there are no positions taken on Friday, in order to avoid the weekend of course.
Entry into position:
For entry into position: every night except Friday
- we define an amplitude, represented by the difference between the highest and the lowest of the last 12 15-minute periods
- a buy-by-limit order is sent to the level of the candle socket, minus this amplitude multiplied by a ratio of 0.5 -
an order of the limit is set, the more the amplitude or the amplitude is multiplied. by a ratio of 0.5
Position exit:
Unstoplossetuntakeprofits are forecast for each position, respectively at 1% and 0.8%.
Longs are closed at 8 p.m., shorts are closed at 8 a.m.
this strategy works with pairs (usd / yen; eur / jpy; gbp / jpy; aud / jpy) but for each pair it is necessary to be able to modify the parameters ratio; sl; tp; periods.
AUD / JPY: ratio = 0.4 / SL = 0.75 / TP = 0.9 / Period = 12
// EUR / JPY: ratio = 0.59 / SL = 0.95 / TP = 1.1 / Period = 8
// GBP / JPY: ratio = 0.47 / SL = 0.95 / TP = 1.15 / Period = 10
// USD / JPY: ratio = 0.64 / SL = 1 / TP = 0.8 / Period = 12
thank you.