breakout pro order ( presente nella libreria)
Forums › ProRealTime forum Italiano › Supporto ProOrder › breakout pro order ( presente nella libreria)
- This topic has 1 reply, 1 voice, and was last updated 9 years ago by
alfredo.
-
-
03/31/2016 at 6:44 PM #4716123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990// We do not store datas until the system starts.// If it is the first day that the system is launched and if it is afternoon,// it will be waiting until the next day for defining sell and buy ordersDEFPARAM PreLoadBars = 0// Position is closed at 7h45 PM, frenh time (in case of CAC40 trading)DEFPARAM FlatAfter = 173000// No new position will be initiated after the 5h00 PM candlestickLimitHour = 153000// Market scan begin with the 15 minute candlestick that closed at 9h15 AMStartHour = 093000// The 24th and 31th days of December will not be traded because market close before 7h45 PMIF (month=3 and day=28) or (Month = 5 AND Day = 1) OR (Month = 12 AND (Day = 24 OR Day = 25 OR Day = 26 OR Day = 30 OR Day = 31)) THENTradingDay = 0ELSETradingDay = 1ENDIF// Variables that would be adapted to your preferencesif time = 090000 thenPositionSize = max(2,2+ROUND((strategyprofit-1000)/1000)) //gain re-invest trade volume//PositionSize = 2 //constant trade volume over the timeendifMaxAmplitude = 80MinAmplitude = 30OrderDistance = 4PourcentageMin = 30// Variable initilization once at system startONCE StartTradingDay = -1// Variables that can change in intraday are initiliazed// at first bar on each new dayIF (Time <= StartHour AND StartTradingDay <> 0) OR IntradayBarIndex = 0 THENBuyTreshold = 0SellTreshold = 0BuyPosition = 0SellPosition = 0StartTradingDay = 0ELSIF Time >= StartHour AND StartTradingDay = 0 AND TradingDay = 1 THEN// We store the first trading day bar indexDayStartIndex = IntradayBarIndexStartTradingDay = 1ELSIF StartTradingDay = 1 AND Time <= LimitHour THEN// For each trading day, we define each 15 minutes// the higher and lower price value of the instrument since StartHour// until the buy and sell tresholds are not definedIF BuyTreshold = 0 OR SellTreshold = 0 THENHighLevel = Highest[IntradayBarIndex - DayStartIndex + 1](High)LowLevel = Lowest [IntradayBarIndex - DayStartIndex + 1](Low)// Spread calculation between the higher and the// lower value of the instrument since StartHourDaySpread = HighLevel - LowLevel// Minimal spread calculation allowed to consider a significant price breakout// of the higher and lower valueMinSpread = DaySpread * PourcentageMin / 100// Buy and sell tresholds for the actual if conditions are metIF DaySpread <= MaxAmplitude THENIF SellTreshold = 0 AND (Close - LowLevel) >= MinSpread THENSellTreshold = LowLevel + OrderDistanceENDIFIF BuyTreshold = 0 AND (HighLevel - Close) >= MinSpread THENBuyTreshold = HighLevel - OrderDistanceENDIFENDIFENDIF// Creation of the buy and sell orders for the day// if the conditions are metIF SellTreshold > 0 AND BuyTreshold > 0 AND (BuyTreshold - SellTreshold) >= MinAmplitude THENIF BuyPosition = 0 THENIF LongOnMarket THENBuyPosition = 1ELSEBUY PositionSize CONTRACT AT BuyTreshold STOPENDIFENDIFIF SellPosition = 0 THENIF ShortOnMarket THENSellPosition = 1ELSESELLSHORT PositionSize CONTRACT AT SellTreshold STOPENDIFENDIFENDIFENDIF// Conditions definitions to exit market when a buy or sell order is already launchedIF LongOnMarket AND ((Time <= LimitHour AND SellPosition = 1) OR Time > LimitHour) THENSELL AT SellTreshold STOPELSIF ShortOnMarket AND ((Time <= LimitHour AND BuyPosition = 1) OR Time > LimitHour) THENEXITSHORT AT BuyTreshold STOPENDIF// Maximal risk definition of loss per position// in case of bad evolution of the instrument priceSET STOP PLOSS MaxAmplitude
Ciao a tutti, ho modificato il codice in modo da farlo lavorare su time frame 5 minuti su Italy cash ma mi apre in alcuni giorni più di due posizioni mentre ho letto che il codice originale dovrebbe aprire al massimo due posizioni al giorno, dov’è il mio errore? Io ho impostato il fuso orario della piattaforma su UTC/00:00
03/31/2016 at 6:52 PM #4717Ciao a tutti, ho modificato il codice in modo da farlo lavorare su time frame 5 minuti su Italy cash ma mi apre in alcuni giorni più di due posizioni mentre ho letto che il codice originale dovrebbe aprire al massimo due posizioni al giorno, dov’è il mio errore? Io ho impostato il fuso orario della piattaforma su UTC/00:00
-
AuthorPosts
Find exclusive trading pro-tools on