Break of Opening 5 min bar
- This topic has 0 replies, 1 voice, and was last updated 8 years ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
Similar topics:
Forums › ProRealTime English forum › ProOrder support › Break of Opening 5 min bar
Hi Nicolas
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
//------------------------------------------------------------------------- // Main code : JAP Breakout 5 min open //------------------------------------------------------------------------- // JAP Breakout 5min // Definition of code parameters DEFPARAM CumulateOrders = False // Cumulating positions deactivated DEFPARAM FLATAFTER = 162000 DEFPARAM PRELOADBARS = 500 LastEntryTime = 083000 //market analysis starts at the 5 min. candle which closes at 8:00 StartTime = 080000 //ignore saturday and Sunday trading TD=Trading Day if DayOfWeek = 6 OR DayOfWeek = 7 THEN TD = 0 else TD = 1 endif //resetting variables when no trades are on market if not onmarket then MAXPRICE = 0 MINPRICE = close priceexit = 0 endif // Money Management Capital = 4000 Risk = 0.03 StopLoss = 45 // VARY TO DETERMINE RISK //Calculate contracts equity = Capital + StrategyProfit maxrisk = round(equity*Risk) PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize) if PositionSize >= 10 Then PositionSize = 10 endif // variables set t personal preferences OrderDistance = 2 //initialize variable once at beginning of trading system ONCE StartTradingDay = -1 //The variables which can change during the day are initialized //at the beginning of each new trading day If (Time <= StartTime AND StartTradingDay <> 0) OR IntradayBarIndex = 0 THEN BuyPrice = 0 SellPrice = 0 StartTradingDay = 0 ELSIF Time >= StartTime AND StartTradingDay = 0 AND TD = 1 THEN //We store the index of the first bar of the trading day IndexStartDay = IntradayBarIndex StartTradingDay = 1 ELSIF StartTradingDay = 1 and Time <= LastEntryTime THEN IF BuyPrice = 0 OR SellPrice = 0 THEN UpperLevel = Highest[IntradayBarIndex - IndexStartDay +1] (High) LowerLevel = Lowest [IntradayBarIndex - IndexStartDay +1] (Low) endif BuyPrice = UpperLevel + OrderDistance*PointSize SellPrice = LowerLevel - OrderDistance*Pointsize endif //Long position indicator3 = Average[100](close) c3= (close > indicator3) IF Time <= LastEntryTime AND c3 THEN BUY PositionSize CONTRACTS AT BuyPrice STOP ENDIF // Conditions to enter short positions indicator4 = Average[100](close) c4 = (close < indicator4) indicator7 = DClose(1) indicator8 = SellPrice c7 = (indicator7 < indicator8) indicator6 = (high-low) c6 = (indicator6 < 42) IF Time <= LastEntryTime AND c6 AND c4 AND C7 THEN SELLSHORT PositionSize CONTRACTS AT SellPrice STOP ENDIF //trailing stop trailingstop = 45 //case SHORT order trailshort = 40 if shortonmarket then MINPRICE = MIN(MINPRICE,Low) //saving the MFE of the current trade if tradeprice(1)-MINPRICE> 0 then //if the MFE is higher than the trailingstop then priceexit = MINPRICE+trailshort*pointsize //set the exit price at the MFE + trailing stop price level endif if tradeprice(1)-MINPRICE<= 0 then priceexit = tradeprice(1)+trailshort*pointsize endif endif //case LONG order if longonmarket then MAXPRICE = MAX(MAXPRICE,High) //saving the MFE of the current trade if MAXPRICE-tradeprice(1)>= 0 then //if the MFE is higher than the trailingstop then priceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price level endif if MAXPRICE-tradeprice(1)<= 0 then priceexit = tradeprice-trailingstop*pointsize// ensures trailing stop is in place mJAP improvement endif endif //exit on trailing stop price levels if onmarket and priceexit>0 then EXITSHORT AT priceexit STOP SELL AT priceexit STOP endif |
Find exclusive trading pro-tools on