DEFPARAM CumulateOrders = False
once x = 1
once noEntryBeforeTime = 063000
once noEntryAfterTime = 173500
bmax1 = (close[0] > open[1]) and (open[0] < close[1]) and (open[1] > close[1])
bmax2 = (high[0] > high[1]) and (low[0] < low[1]) and (close[0] > high[1])
IF NOT ONMARKET THEN
myorder = 0
parstop = 0
profitto = 0
if (gmaxbuy) then
gindice = gindice + 1
else
gindice = 0
endif
if gindice > 2 then
gmaxbuy = 0
toccato = 0
endif
if (bmax1 and bmax2) then
gmaxbuy = 1
endif
// time
// **************************************************************************************
timeEnterBefore = time > noEntryBeforeTime
timeEnterAfter = time < noEntryAfterTime
if timeEnterBefore and timeEnterAfter then
a = 1
else
a = 0
endif
//ORDINE double top bottom
// **************************************************************************************
if (a and gmaxbuy and toccato = 0) THEN //apre e rinnova ordine
doveentrare = high[gindice] - ((high[gindice] - low[gindice]) / 2) // 2 = 50% barra 1.5 = 66% 1.2 = 83%
myorder = doveentrare
if gindice < 3 then //aspetto max 2 candele
BUY x CONTRACT AT myorder limit
if gindice = 0 then //solo 1 volta stop e profit
profitto = (high[gindice] - low[gindice]) * 1 //10 //- myorder //* 2 //1.5 // rischio 1:1.5
parstop = (high[gindice] - low[gindice]) * 1.10 // 10 // * 1.2)
SET STOP pLOSS parstop
SET TARGET pPROFIT profitto
endif
endif
endif
ELSIF ONMARKET THEN
toccato = 1
//ferma tutto il venerdì alle 22:00 ***********************************************
if ((OpenDayOfWeek = 5) AND (time >= 220000)) THEN
sell at market
exitshort at market
endif
endif
// ************************ attendere sviluppo piattaforma *********************************
//5 minute TF (get the trend of the 5 minute chart)
//timeframe (1 minutes,updateonclose)
//manage long positions TRAILING STEP
//"default" timeframe (the timeframe you will launch the strategy on)
//timeframe(default)
// *****************************************************************************************
// DEBUG
//***********************************************************************************
graph toccato
graph gmaxbuy
graph gindice
graph parstop
graph myorder
graph profitto