Hi,
I created a very easy strategy for PRT
// ===== PARAMETERS =====
emaPeriod = 30 //
// ===== INDICATORS =====
ema30 = ExponentialAverage[emaPeriod](close)
// ===== TIME FILTER (Berlin 14:00-18:00) =====
tradeTime = (time >= 140000 AND time <= 180000)
// ===== ENTRY CONDITION =====
crossAbove = close crosses over ema30
// ===== RESET WHEN FLAT =====
IF NOT longonmarket THEN
secondEntryTaken = 0
thirdEntryTaken = 0
ENDIF
// ===== FIRST ENTRY =====
IF NOT longonmarket THEN
IF tradeTime AND crossAbove THEN
entry1 = close
// Levels for averaging entries
entry2Trigger = entry1 * 0.975 // -2.5%
slTotal = entry1 * 0.90 // -10% stop
BUY 0.05 CONTRACT AT MARKET
ENDIF
ENDIF
// ===== SECOND ENTRY =====
IF longonmarket AND secondEntryTaken = 0 THEN
IF close <= entry2Trigger THEN
entry2 = close
secondEntryTaken = 1
// Third entry trigger (another -2.5% drop)
entry3Trigger = entry2 * 0.975
BUY 0.05 CONTRACT AT MARKET
ENDIF
ENDIF
// ===== THIRD ENTRY =====
IF longonmarket AND secondEntryTaken = 1 AND thirdEntryTaken = 0 THEN
IF close <= entry3Trigger THEN
entry3 = close
thirdEntryTaken = 1
BUY 0.05 CONTRACT AT MARKET
ENDIF
ENDIF
// ===== EXIT LOGIC =====
IF longonmarket THEN
// Determine how many positions are open and compute average price
IF thirdEntryTaken = 1 THEN
avgPrice = (entry1 + entry2 + entry3) / 3
ELSIF secondEntryTaken = 1 THEN
avgPrice = (entry1 + entry2) / 2
ELSE
avgPrice = entry1
ENDIF
// Combined +3% target based on average price
tpCombined = avgPrice * 1.03
// ---- TAKE PROFIT ----
IF close >= tpCombined THEN
SELL AT MARKET
ENDIF
// ---- STOP LOSS (based on first entry) ----
IF close <= slTotal THEN
SELL AT MARKET
ENDIF
ENDIF
(very new o the platform). Somehow it does not open any trade. I just want to try this strategy on the tester and go from it…Any help is highly appreciated!
Try below (0.05 Contracts is below minimum allowed)…
BUY 1 CONTRACT AT MARKET
0.5 Contracts may be okay also.
Exactly. Just as @GraHal says.
Thank you very much for your help guys, it was much appreciated! I just have another question regarding the strategy above. How difficult it will be to remove the stop loss and add to the (SL) level an Hedge order with the double quantity of lots previously open? In this case I will also need an averaging Take Profit that consider all open positions…Just an idea for now. Thx in advance for your inputs.