DEFPARAM CumulateOrders = FALSE
//
Timeframe(1h,UpdateOnClose)
// — Ichimoku —
myTenkanSen1 = (highest[7](high) + lowest[7](low)) / 2
myKijunSen1 = (highest[22](high) + lowest[22](low)) / 2
//mySpanA1 = (myTenkanSen1[26] + myKijunSen1[26]) / 2
//mySpanB1 = (highest[52](high[26]) + lowest[52](low[26])) / 2
//myChikou1 = close[26]
L1 = myTenkanSen1 > myKijunSen1
S1 = myTenkanSen1 < myKijunSen1
//
Timeframe(5 minute,UpdateOnClose)
// — Ichimoku —
myTenkanSen2 = (highest[7](high) + lowest[7](low)) / 2
myKijunSen2 = (highest[22](high) + lowest[22](low)) / 2
//mySpanA2 = (myTenkanSen2[26] + myKijunSen2[26]) / 2
//mySpanB2 = (highest[52](high[26]) + lowest[52](low[26])) / 2
//myChikou2 = close[26]
L2 = myTenkanSen2 CROSSES OVER myKijunSen2
S2 = myTenkanSen2 CROSSES UNDER myKijunSen2
//
Timeframe(default)
ONCE Lbreak = 0
ONCE Sbreak = 0
//
IF Lcond = 0 THEN
Lcond = L1 AND L2 AND Not OnMarket
IF Lcond THEN
Scond = 0
ENDIF
ENDIF
IF Scond = 0 THEN
Scond = S1 AND S2 AND Not OnMarket
IF Scond THEN
Lcond = 0
ENDIF
ENDIF
//
IF Lcond and Not Lcond[1] THEN
Lbreak = 0
MyHI = high[1]
ELSIF Scond and Not Scond[1] THEN
Sbreak = 0
MyLO = low[1]
ENDIF
IF OnMarket THEN
Lcond = 0
Scond = 0
Lbreak = 0
Sbreak = 0
ENDIF
IF Lcond THEN
Lbreak = close CROSSES OVER MyHI
ELSIF Scond THEN
Sbreak = close CROSSES UNDER MyLO
ENDIF
// LONG
IF Lcond AND Lbreak THEN
BUY 1 CONTRACTS AT MARKET
Lbreak = 0
ENDIF
// condicions de sortida
indicador1=myKijunSen2
c1 = (close < myKijunSen2)
IF longonmarket and c1 then
sell at market
endif
// SHORT
IF Scond AND Sbreak THEN
SELLSHORT 1 CONTRACTS AT MARKET
ENDIF
// exit short
c2 = (close > myKijunSen2)
if shortonmarket and c2 then
Exitshort at market
endif
//SET TARGET pPROFIT 200
//SET STOP pLOSS 100