ProRealCode - Trading & Coding with ProRealTime™
Hi,
I have a strategy that shows results in Demo Backtest but no trades are taken in Demo Autotrade.
My strategy works for USDJPY on the 1 min TF and uses a number of indicators (standard and proprietary) plus I refer to the 15 min, 1hr and 4hr TF for creating “no-entry” conditions. I use PRT v10.3 with IG Markets.
What could be the reason that no trades are executed?
I tested a version of the code where I deleted all references to the 15min and 1hr TF and then trades where taken.
Below is part of my code, so maybe someone experienced can see the problem.
Thanks.
Sascha
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
DEFPARAM Preloadbars = 10000
// Prevents the system from placing new orders on specified days of the week
//daysForbiddenEntry = OpenDayOfWeek = 0
//----------------------------------------------------------------------------------------------------
//-----------------------------------------------LONG-------------------------------------------------
timeframe(4 hour, default)
EMA214hr= ExponentialAverage[21](close)
Sto84hr = Stochastic[8,3](close)
ignored, MFneutral4hr, ignored = CALL "Momentum_F"
LBishop1barago4hr = ADX[14][1]>40 AND ADX[14][1]<ADX[14][2] AND ADX[14][2]>ADX[14][3]
LongNoentry4hr = LBishop1barago4hr
timeframe(1 hour, default)
ignored, MFneutral1hr, ignored = CALL "Momentum_F"
ignored, ignored, MFbear1hr = CALL "Momentum_F"
Sto141hr = Stochastic[14,3](close)
LdoublebeID1hr = close[1]<open[1] AND high[1]<high[2] AND low[1]>low[2] AND close[2]<open[2] AND high[2]<high[3]+0.001 AND low[2]>low[3] AND Sto141hr[1]<Sto141hr[2] AND Sto141hr[2]<Sto141hr[3] AND Sto141hr[3]>94
Lbe1DSDbuSS1hr = close[1]>open[1] AND (high[1]-close[1])/MAX(0.00001,(high[1]-low[1]))>0.72 AND Sto141hr[1]<Sto141hr[2] AND Sto141hr[2]>86
LbeSID1hr = close[1]<open[1] AND high[1]<high[2] AND low[1]>open[2] AND Sto141hr[1]<Sto141hr[2] AND Sto141hr[2]>Sto141hr[3] AND Sto141hr[2]>79
LbeHM1hr = close[1]<open[1] AND (close[1]-low[1])/MAX(0.00001,(high[1]-low[1]))>0.58 AND (open[1]-close[1])/MAX(0.00001,(high[1]-low[1]))<0.27 AND Sto141hr[1]>78
LongNoentry1hr = LdoublebeID1hr OR Lbe1DSDbuSS1hr OR LbeSID1hr OR LbeHM1hr
timeframe(15 minute, default)
Sto815m = Stochastic[8,3](close)
Sto1415m = Stochastic[14,3](close)
ATR15m = Averagetruerange[14]
ADX15m = ADX[14]
EMA815m= ExponentialAverage[8](close)
EMA2115m= ExponentialAverage[21](close)
EMA5015m= ExponentialAverage[50](close)
SMA1015m= Average[10](close)
SMA5015m= Average[50](close)
SMA20015m= Average[200](close)
ignored, MFneutral15m, ignored = CALL "Momentum_F"
PlusIncrease, ignored, ignored, ignored, ignored = CALL "PRC_TTM Squeeze 10.3"[20, 2, 20, 1.5, 0, 0]
ignored, PlusDecrease, ignored, ignored, ignored = CALL "PRC_TTM Squeeze 10.3"[20, 2, 20, 1.5, 0, 0]
ignored, ignored, MinusIncrease, ignored, ignored = CALL "PRC_TTM Squeeze 10.3"[20, 2, 20, 1.5, 0, 0]
ignored, ignored, ignored, MinusDecrease, ignored = CALL "PRC_TTM Squeeze 10.3"[20, 2, 20, 1.5, 0, 0]
LTTMdown15m = PlusDecrease<PlusDecrease[1] AND PlusDecrease[1]<PlusDecrease[2] AND PlusDecrease>0 AND PlusDecrease[1]>0 AND PlusDecrease[2]>0
LTTMdown15m2 = MinusIncrease>MinusDecrease[1] AND MinusDecrease[1]<MinusDecrease[2] AND MinusIncrease<0 AND MinusDecrease[1]<0 AND MinusDecrease[2]<0
LbuHMatSMA200 = close[1]>open[1] AND (open[1]-low[1])/MAX(0.00001,(high[1]-low[1]))>0.53 AND (close[1]-open[1])/MAX(0.00001,(high[1]-low[1]))<0.25 AND open[1]<SMA20015m[1] AND close>SMA20015m[1] AND Sto1415m[1]>88
Lbe1DSDupbeRB15m = close[1]<open[1] AND high[1]>high[2] AND close[1]<close[2] AND close[2]>open[2] AND Sto815m[1]<Sto815m[2] AND Sto815m[2]<Sto815m[3] AND Sto815m[3]>92
LHLRange15m = (high[1]-low[1])/ATR15m[2]>5.9
LEMA21belowSMA5015m = EMA2115m<SMA5015m AND ADX[14]>47
LEMA21belowSMA5015m2 = EMA2115m<SMA5015m AND Sto815m>80 AND EMA2115m[3]<EMA5015m[3] AND EMA2115m[4]>EMA5015m[4]
LbeSID15m = close[1]<open[1] AND high[1]<high[2] AND low[1]>low[2] AND Sto815m[1]<Sto815m[2] AND Sto815m[2]>Sto815m[3] AND Sto815m[2]>85
LMFbear1hrMFneutral15m = MFbear1hr=1 AND MFneutral15m=1 AND Sto1415m>90
//-----------------------------------------------------------------------
LbeSS15m = close[1]<open[1] AND high[1]>high[2] AND close[1]<close[2] AND (high[1]-open[1])/MAX(0.00001,(high[1]-low[1]))>0.58 AND (open[1]-close[1])/MAX(0.00001,(high[1]-low[1]))<0.26 AND close[2]>open[2] AND Sto1415m[1]<Sto1415m[2] AND Sto1415m[2]>90
LbeSS15m2 = close[1]<open[1] AND high[1]>high[2] AND close[1]<close[2] AND (high[1]-open[1])/MAX(0.00001,(high[1]-low[1]))>0.56 AND (open[1]-close[1])/MAX(0.00001,(high[1]-low[1]))<0.33 AND close[2]>open[2] AND Sto1415m[1]>82
//-----------------------------------------------------------------------
Ldoublebe1DSDupup15m = close[1]>open[1] AND close[1]>high[2] AND close[2]>open[2] AND Sto1415m[1]<Sto1415m[2] AND Sto1415m[2]<Sto1415m[3] AND Sto1415m[3]>88
LDojiSS15m = close[1]=open[1] AND high[1]>high[2] AND (high[1]-close[1])/MAX(0.00001,(high[1]-low[1]))>0.70 AND Sto1415m[1]>91
LRR5515m2 = close[1]<open[1] AND high[1]>high[2] AND close[1]<close[2] AND high[1]>highest[55](high)[3] AND close[1]<highest[55](high)[3] AND close[2]>open[2] AND close[2]>highest[55](high)[3] AND highest[55](high)[3]<=highest[55](high)[4] AND highest[55](high)[4]<=highest[55](high)[5] AND highest[55](high)[5]<=highest[55](high)[6] AND highest[55](high)[6]<=highest[55](high)[7] AND highest[55](high)[7]<=highest[55](high)[8] AND Sto1415m[1]>79
LbeRB15m = close[1]<open[1] AND high[1]>high[2] AND close[1]<close[2] AND close[2]>open[2] AND Sto1415m[1]>69 AND PlusDecrease[1]<PlusIncrease[2] AND PlusIncrease[2]>PlusDecrease[3] AND PlusDecrease[1]>0 AND PlusIncrease[2]>0
LbeKRB15m = close[1]<open[1] AND high[1]>high[2] AND low[1]<low[2] AND close[1]<close[2] AND close[2]>open[2] AND Sto1415m[1]<Sto1415m[2] AND Sto1415m[2]>94
LbeTW15m = close[1]<open[1] AND close[1]<open[2] AND close[2]>open[2] AND open[1]>EMA815m[1] AND close[1]<EMA815m[1] AND Sto1415m[1]>80
LMFneutralResistanceSMA20015m = MFneutral15m[1]=1 AND close[1]<SMA20015m[1] AND SMA20015m[1]-close[1]<0.7*ATR15m AND Sto815m[1]>78
LDowntrend15m2 = EMA815m<EMA2115m AND EMA2115m<SMA5015m AND EMA2115m<SMA20015m AND SMA5015m<SMA20015m AND SMA1015m<EMA815m AND Sto1415m>76
LbeRBatSMA5015m = close[1]<open[1] AND high[1]>high[2] AND close[1]<close[2] AND close[2]>open[2] AND Sto1415m[1]>86 AND open[1]>SMA5015m[1] AND close[1]<SMA5015m[1]
LbeRBatSMA5015m2 = close[1]<open[1] AND high[1]>high[2] AND close[1]<close[2] AND close[2]>open[2] AND Sto1415m[1]>68 AND open[1]<SMA5015m[1] AND high[1]>SMA5015m[1] AND close[1]<SMA5015m[1]
LongNoentry15m = LTTMdown15m2 OR LbuHMatSMA200 OR Lbe1DSDupbeRB15m OR LHLRange15m OR LEMA21belowSMA5015m OR LEMA21belowSMA5015m2 OR LbeSID15m OR LMFbear1hrMFneutral15m OR LbeSS15m OR LbeSS15m2 OR Ldoublebe1DSDupup15m OR LDojiSS15m OR LRR5515m2 OR LbeRB15m OR LbeKRB15m OR LbeTW15m OR LMFneutralResistanceSMA20015m OR LDowntrend15m2 OR LbeRBatSMA5015m OR LbeRBatSMA5015m2
//.........................................................
LbuSS15m = close[1]>open[1] AND (high[1]-close[1])/MAX(0.00001,(high[1]-low[1]))>0.59 AND (close[1]-open[1])/MAX(0.00001,(high[1]-low[1]))<0.30 AND Sto1415m[1]>71
LDowntrend15m = EMA815m<EMA2115m AND EMA2115m<SMA5015m AND EMA2115m<SMA20015m AND SMA5015m<SMA20015m AND Sto1415m<Sto1415m[1] AND NOT (Sto1415m[1]>Sto1415m[2] AND Sto1415m[2]<Sto1415m[3])
LDowntrend15m3 = SMA5015m<SMA20015m AND Sto815m>85 AND SMA20015m-SMA5015m>5*ATR15m
LbeSSexit15m = close[1]<open[1] AND high[1]>high[2] AND close[1]<close[2] AND (high[1]-open[1])/MAX(0.00001,(high[1]-low[1]))>0.58 AND (open[1]-close[1])/MAX(0.00001,(high[1]-low[1]))<0.26 AND close[2]>open[2] AND Sto1415m[1]<Sto1415m[2] AND Sto1415m[2]>90
LRR5515m = close[1]>open[1] AND high[1]>highest[55](high)[2] AND close[1]<highest[55](high)[2] AND highest[55](high)[2]<=highest[55](high)[3] AND highest[55](high)[3]<=highest[55](high)[4] AND highest[55](high)[4]<=highest[55](high)[5] AND highest[55](high)[5]<=highest[55](high)[6] AND highest[55](high)[6]<=highest[55](high)[7] AND highest[55](high)[7]<=highest[55](high)[8] AND Sto1415m[1]>73
LRR55Exit15m = close[1]<open[1] AND (high[1]-open[1])/MAX(0.00001,(high[1]-low[1]))>0.70 AND high[1]>highest[55](high)[2] AND close[1]<highest[55](high)[2] AND highest[55](high)[2]<=highest[55](high)[3] AND highest[55](high)[3]<=highest[55](high)[4] AND highest[55](high)[4]<=highest[55](high)[5] AND highest[55](high)[5]<=highest[55](high)[6] AND highest[55](high)[6]<=highest[55](high)[7] AND Sto1415m[1]>72
ADX15above39 = ADX15m[1]>39.5
LSto14above9015m = Sto1415m[1]>90
LSto14above8615m = Sto1415m[1]>86.7 AND Sto815m[1]>80 AND SMA5015m<SMA20015m AND EMA2115m<SMA20015m AND (Sto1415m[1]<Sto1415m[2] OR (Sto1415m[1]>Sto1415m[2] AND Sto1415m[2]<Sto1415m[3]))
LbuSSExit15m = close[1]>open[1] AND (high[1]-close[1])/MAX(0.00001,(high[1]-low[1]))>0.76 AND Sto815m[1]>81 AND SMA5015m[1]<SMA20015m[1]
LDowntrendSto8above9415m = close<SMA5015m AND SMA5015m<SMA20015m AND EMA815m<SMA5015m AND EMA2115m<SMA5015m AND Sto815m>94
timeframe(1 minute, default)
EURJPY = 131.10
EMA8 = ExponentialAverage[8](close)
EMA21= ExponentialAverage[21](close)
//EMA50= ExponentialAverage[50](close)
SMA10 = Average[10](close)
SMA50 = Average[50](close)
SMA200= Average[200](close)
Sto14 = Stochastic[14,3](close)
Sto8 = Stochastic[8,3](close)
ATR = Averagetruerange[14]
Green82150, ignored, ignored, ignored = CALL "8-21-50"
ignored, Yellow82150, ignored, ignored = CALL "8-21-50"
ignored, ignored, Orange82150, ignored = CALL "8-21-50"
ignored, ignored, ignored, Red82150 = CALL "8-21-50"
MFbull, ignored, ignored = CALL "Momentum_F"
ignored, MFneutral, ignored = CALL "Momentum_F"
ignored, ignored, MFbear = CALL "Momentum_F"
Flag821bull, ignored = CALL "8-21 Flag"
//ignored, Flag821bear = CALL "8-21 Flag"
PX2bull, ignored = CALL "PowerX 2"
ignored, PX2bear = CALL "PowerX 2"
//ignored, PMFgreen, ignored, ignored, ignored = CALL "PowerMomentumFlag"
ignored, ignored, ignored, PMFred, ignored = CALL "PowerMomentumFlag"
Squeezeon, ignored = CALL "Squeeze"
Sun = DayOfWeek=0 and time<230000
Mon = DayOfWeek=1 and time<=010000 AND SMA10>SMA10[1]
Fri = DayOfWeek = 5 and time>=183000
//-------------------------------------------Events----------------------------------------
GBP3amMondy = DayOfWeek=1 AND time<=030000 AND close>1.3870 AND close<1.3890
AUD3amMondy = DayOfWeek=1 AND time<=030000 AND close>0.7580 AND close<0.7590
FOMC16062021 = day=16 and month=6 and year=2021 AND time>=120000
FOMC28042021 = day=28 and month=4 and year=2021 AND time>=120000
ECB22042021 = day=22 and month=4 and year=2021 AND time>=060000 AND time<150000
AUDMonetaryPolicyMeetingMinutes = day=15 and month=6 and year=2021 AND time<=050000 AND close>0.7690 AND close<0.7710 //for AUDUSD
//CPIforUS10062021 = day=10 and month=06 and year=2021 AND time>=080000 AND time<=140000
BOC09062021 = day=9 and month=06 and year=2021 AND time>=050000 AND time<=160000 AND ((close>0.7180 AND close<0.7220)) //NZDUSD indirect impact via CAD->AUD
GBPMoneytaryPolicySummary24062021 = day=24 and month=06 and year=2021 AND time>=060000 AND time<140000 AND ((close>1.3960 AND close<1.3980))
NFP07052021 = day=7 and month=5 and year=2021 AND time>=080000 AND time<150000
GBPMonetaryPolicy24052021 = day=24 and month=5 and year=2021 AND time>=100000 AND time<160000 AND close>1.2050 AND close<1.2080 //for USDCAD
ADPNonFarm30062021 = day=30 and month=6 and year=2021 AND time>=110000 AND time<140000 AND close>1.3850 AND close<1.3870 //for GBPUSD
USCPI13072021 = day=13 and month=7 and year=2021 AND time>=123000 AND time<140000
NFP06082021 = day=6 and month=8 and year=2021 AND time>=080000 AND time<150000
Events = Sun OR Mon OR GBP3amMondy OR AUD3amMondy OR FOMC16062021 OR FOMC28042021 OR ECB22042021 OR AUDMonetaryPolicyMeetingMinutes OR BOC09062021 OR GBPMoneytaryPolicySummary24062021 OR NFP07052021 OR GBPMonetaryPolicy24052021 OR ADPNonFarm30062021 OR USCPI13072021 OR NFP06082021
//-----------------------------------------------------------------------------------------
// LongNoentry:
LBishop3barsago = ADX[14][3]>40 AND ADX[14][3]<ADX[14][4] AND ADX[14][4]>ADX[14][5]
LBishop4barsago = ADX[14][4]>40 AND ADX[14][4]<ADX[14][5] AND ADX[14][5]>ADX[14][6]
LBishop6barsago = ADX[14][6]>40 AND ADX[14][6]<ADX[14][7] AND ADX[14][7]>ADX[14][8]
LBishop8barsago = ADX[14][8]>40 AND ADX[14][8]<ADX[14][9] AND ADX[14][9]>ADX[14][10]
LBishop9barsago = ((ADX[14][9]>40 OR (ADX[14][9]<40) AND ADX[14][10]>40)) AND ADX[14][9]<ADX[14][10] AND ADX[14][10]>ADX[14][11]
LBishop10barsago = ADX[14][10]>50 AND ADX[14][10]<ADX[14][11] AND ADX[14][11]>ADX[14][12]
LBishop12barsago = ADX[14][12]>50 AND ADX[14][12]<ADX[14][13] AND ADX[14][13]>ADX[14][14]
LBishop25barsago = ADX[14][25]>40 AND ADX[14][25]<ADX[14][26] AND ADX[14][26]>ADX[14][27]
LAllBishop = LBishop3barsago OR LBishop4barsago OR LBishop6barsago OR LBishop8barsago OR LBishop9barsago OR LBishop10barsago OR LBishop12barsago OR LBishop25barsago
//--------
LADX14above40 = ADX[14]>40
LHLRange = (high-low[1])/ATR[2]>8 AND NOT (MFbull=1 AND MFbull[1]=0)
LHLRange2 = (high-low[1])/ATR[2]>5.5 AND Sto14>86
Lbe1DSDbuSS = close>open AND high>high[1] AND (high-close)/MAX(0.00001,(high-low))>0.76 AND Sto14<Sto14[1] AND Sto14[1]>93
LSMA10crossSMA50 = EMA21>SMA50 AND EMA21[1]<SMA50[1] AND Sto14>92
LMFneutral = MFneutral=1 AND Sto14>77 AND Sto8>66
LPX2is2andADX14less25 = PX2bull=2 AND PX2bull[1]=2 AND ADX[14]<25
Lbe1DSDup = close>open AND close>high[1] AND Sto14<Sto14[1] AND Sto8<Sto8[1] AND Sto14[1]>89 AND (high-low[1])/ATR[2]>4.4
Lbe1DSDup2 = close>open AND close>high[1] AND Sto14<Sto14[1] AND Sto8<Sto8[1] AND Sto14[1]>97 AND Sto8[1]>96
Lbe1DSDup3 = close>open AND close>high[1] AND Sto14<Sto14[1] AND Sto8<Sto8[1] AND Sto14[1]>75 AND Sto8[1]>78 AND MFneutral15m=1
LMFneutral15mSto14above86 = MFneutral15m=1 AND Sto14[1]>87 AND Sto14<Sto14[1]
LTTMdown15mWithException = LTTMdown15m AND NOT (MFbull=1 AND MFbull[1]=0)
LbuSS15mWithException = LbuSS15m AND Sto8<Sto8[1] AND Sto8[1]<Sto8[2] AND Sto8[2]>88
LdoubleMFneutral1hrAnd15m = MFneutral1hr=1 AND MFneutral15m=1 AND Sto14>90
LdoubleMFneutral1hrAnd15m2 = MFneutral1hr=1 AND MFneutral15m=1 AND Sto8>83
LDowntrend15mSto14above90 = (Sto14>90 OR (Sto14>85 AND Sto8>85) OR (Sto14>77 AND ADX[14]>33)) AND EMA815m<EMA2115m AND EMA2115m<SMA5015m AND EMA2115m<SMA20015m
LDowntrend15mWithException = LDowntrend15m AND Sto14>56
LDowntrend15mWithException2 = (EMA815m<SMA5015m OR EMA815m<EMA5015m) AND EMA2115m<SMA5015m AND SMA5015m<SMA20015m AND SMA5015m<SMA5015m[1] AND SMA20015m<SMA20015m[1] AND SMA50<SMA200 AND SMA200-SMA50>1.1*ATR
LDowntrend15m3WithException = LDowntrend15m3 AND NOT (Green82150=1 AND Green82150[1]=0)
LbuHM = close>open AND (open-low)/MAX(0.00001,(high-low))>0.73 AND (close-open)/MAX(0.00001,(high-low))<0.27 AND Sto14>84
LbuSSbeforeEntry = close[1]>open[1] AND (high[1]-close[1])/MAX(0.00001,(high[1]-low[1]))>0.61 AND (close[1]-open[1])/MAX(0.00001,(high[1]-low[1]))<0.28 AND Sto8[1]<Sto8[2] AND Sto14[1]>77
LbuSSonEntry = close>open AND (high-close)/MAX(0.00001,(high-low))>=0.75 AND (close-open)/MAX(0.00001,(high-low))<=0.25 AND Sto14>65
LSMA50crossSMA200b = SMA50>SMA200 AND SMA50[1]<SMA200[1] AND Sto14>72 AND time<060000
LSMA10crossEMA21 = SMA10<EMA21 AND SMA10[1]>EMA21[1] AND SMA10<SMA10[1] AND Sto8>65
LEMA21crossSMA50 = EMA21>SMA50 AND EMA21[1]<SMA50[1] AND Sto14>70 AND EMA2115m<SMA5015m AND EMA2115m<SMA20015m
LADX15mabove50Stoabove80 = Sto14>80 AND ADX15m>50
LADX15mabove39andADX1mabove39 = ADX15above39 AND ADX[14]>38.7
LFridaySto8above98 = DayOfWeek=5 and time>=170000 AND Sto8>98
LADX38be1DSDup = close>open AND Sto14<Sto14[1] AND Sto14[1]>97 AND ADX[14]>38
LSto8at100 = Sto8=100
LSto14above8615mWithException = LSto14above8615m AND Sto14>73
LDowntrendSto8above9415mSto14above88 = LDowntrendSto8above9415m AND Sto14>88
LSto1415mabove82Sto14above92 = Sto1415m>82 AND Sto14>92
LATRtooLow = ATR<0.005 AND time>230000 AND time<=235900
//.........................................................
LongNoentry = LAllBishop OR Fri OR LADX14above40 OR LHLRange OR LHLRange2 OR Lbe1DSDbuSS OR LSMA10crossSMA50 OR LMFneutral OR LPX2is2andADX14less25 OR Lbe1DSDup OR Lbe1DSDup2 OR Lbe1DSDup3 OR LMFneutral15mSto14above86 OR LTTMdown15mWithException OR LbuSS15mWithException OR LdoubleMFneutral1hrAnd15m OR LdoubleMFneutral1hrAnd15m2 OR LDowntrend15mSto14above90 OR LDowntrend15mWithException OR LDowntrend15mWithException2 OR LDowntrend15m3WithException OR LbuHM OR LbuSSbeforeEntry OR LbuSSonEntry OR LSMA50crossSMA200b OR LSMA10crossEMA21 OR LEMA21crossSMA50 OR LADX15mabove50Stoabove80 OR LADX15mabove39andADX1mabove39 OR LFridaySto8above98 OR LADX38be1DSDup OR LSto8at100 OR LSto14above8615mWithException OR LDowntrendSto8above9415mSto14above88 OR LSto1415mabove82Sto14above92 OR LATRtooLow
LADX15mabove55WithException = ADX15m>55 AND NOT (MFbull=1 AND MFbull[1]=0)
LMFneutral2 = MFneutral=1 AND MFneutral[1]=1
LHLRange2 = (high-low[1])/ATR[2]>4.4 AND Sto8>76
LHLRange3 = (high-low[1])/ATR[2]>3.4 AND Sto8>71 AND Sto14>60
LSto14above9015mWithException = LSto14above9015m AND SMA10<SMA10[1]
// Without: LPX2is2andADX14less25
LongNoentryTMA = LAllBishop OR Fri OR LADX14above40 OR LHLRange OR Lbe1DSDbuSS OR LSMA10crossSMA50 OR LMFneutral OR Lbe1DSDup OR Lbe1DSDup2 OR Lbe1DSDup3 OR LMFneutral15mSto14above86 OR LTTMdown15mWithException OR LbuSS15mWithException OR LdoubleMFneutral1hrAnd15m OR LdoubleMFneutral1hrAnd15m2 OR LDowntrend15mSto14above90 OR LDowntrend15mWithException OR LbuHM OR LbuSSbeforeEntry OR LbuSSonEntry OR LSMA50crossSMA200b OR LSMA10crossEMA21 OR LEMA21crossSMA50 OR LADX15mabove50Stoabove80 OR LADX15mabove39andADX1mabove39 OR LFridaySto8above98 OR LADX38be1DSDup OR LSto8at100 OR LSto14above8615mWithException OR LDowntrendSto8above9415mSto14above88 OR LSto1415mabove82Sto14above92 OR ATR<0.0055 OR LADX15mabove55WithException OR LMFneutral2 OR LHLRange2 OR LHLRange3 OR LSto14above9015mWithException OR LATRtooLow
//.........................................................
LFiveDayCond55 = highest[55](high)[1]=highest[55](high)[2] AND highest[55](high)[2]=highest[55](high)[3] AND highest[55](high)[3]=highest[55](high)[4] AND highest[55](high)[4]=highest[55](high)[5] AND highest[55](high)[5]=highest[55](high)[6]
LFiveDayCond60 = highest[60](high)[1]<=highest[60](high)[2] AND highest[60](high)[2]<=highest[60](high)[3] AND highest[60](high)[3]<=highest[60](high)[4] AND highest[60](high)[4]<=highest[60](high)[5] AND highest[60](high)[5]<=highest[60](high)[6] AND Sto14<92 //USDJPY 09.07.2021 9:45
// or 15m Uptrend: EMA8+EMA21 > SMA50
LSetup1a = ((LFiveDayCond55 AND close>highest[55](high)[1]) OR (LFiveDayCond60 AND close>highest[60](high)[1])) AND close>open AND EMA8>SMA50 AND EMA21>SMA50 AND SMA50>SMA200 AND PX2bull=3 AND PX2bull[1]=3 AND NOT (ATR<0.4*pipsize) AND (EMA21[1]-SMA50[1]>0.0004) AND ATR>0.005
LSetup1c = ((LFiveDayCond55 AND close>highest[55](high)[1]) OR (LFiveDayCond60 AND close>highest[60](high)[1])) AND close>open AND EMA8>SMA50 AND EMA21>SMA50 AND SMA50>SMA200 AND PX2bull=3 AND PX2bull[1]=3 AND NOT (ATR<0.4*pipsize) AND (EMA21[1]-SMA50[1]>0.0004) AND ATR<=0.005
LSetup2 = ((LFiveDayCond55 AND close>highest[55](high)[1]) OR (LFiveDayCond60 AND close>highest[60](high)[1])) AND close>open AND EMA8>SMA50 AND EMA21>SMA50 AND SMA50>SMA200 AND ((PX2bull<3 AND PX2bull[1]<3) OR (PX2bull=3 AND PX2bull[1]<3) OR (PX2bull=3 AND PX2bull[1]=3 AND (ATR<0.4*pipsize))) AND (EMA21[1]-SMA50[1]>0.0004)
// DD55 breakout + close at breakout
LSetup1b = LFiveDayCond55 AND high>highest[55](high)[1] AND close=highest[55](high)[1] AND close>open AND EMA8>SMA50 AND EMA21>SMA50 AND SMA50>SMA200 AND PX2bull=3 AND PX2bull[1]=3 AND Sto14>Sto14[1] AND Sto8>Sto8[1] AND Sto14<76
LSetup3 = ((LFiveDayCond60 AND close>highest[60](high)[1])) AND close>open AND EMA8>SMA50 AND EMA21>SMA50 AND (SMA50<SMA200 AND SMA200-SMA50<0.018) AND PX2bull>2 AND PlusIncrease>0
//---------------------------
SADX15mabove50SMA10down = ADX15m>50 AND SMA10<SMA10[1]
L15mDownSMA10down = EMA2115m<SMA5015m AND EMA2115m<SMA20015m AND SMA10<=SMA10[1]
LTMA = Green82150=1 AND Green82150[1]=0 AND close>open AND close>SMA50 AND close>SMA200 AND close>EMA8 AND close>EMA21 AND close>SMA10 AND EMA8>SMA50 AND EMA21>SMA50 AND Sto14>Sto14[1] AND Sto8>Sto8[1] AND Sto14<80 AND Sto8<80 AND LFiveDayCond55 AND MFbull=1 AND NOT Yellow82150[1]=1 AND NOT ( SADX15mabove50SMA10down OR L15mDownSMA10down)
LTMA2 = Green82150=1 AND Green82150[1]=0 AND Yellow82150[1]=1 AND close>open AND close>SMA50 AND close>SMA200 AND close>EMA8 AND close>EMA21 AND close>SMA10 AND EMA8>SMA50 AND EMA21>SMA50 AND Sto14>Sto14[1] AND Sto8>Sto8[1] AND Sto14<80 AND Sto8<80 AND LFiveDayCond60 AND (MFbull=1 OR (Flag821bull=1 AND Flag821bull[1]=0)) AND NOT ( SADX15mabove50SMA10down OR L15mDownSMA10down)
//.........................................................
if not onmarket then
LMarkerATRConq=ATR
endif
LBuffer = 0.002
LBuffer2 = 0.005
//LProfitBuffer = 0.00001
if (LSetup1a ) AND NOT LongOnMarket AND NOT LongNoentry AND NOT Events AND NOT LongNoentry15m AND NOT LongNoentry1hr AND NOT LongNoentry4hr then
//LMarkerConqueror=1
LMarkerATRConq=ATR
ISL = 100*((close-lowest[20](low))/5*4 + LBuffer)
TradeRisk = pipvalue*ISL/EURJPY
ContractSize = 100/TradeRisk
BUY ContractSize SHARES AT market
//barorder=barindex
// Stops and targets
SET STOP LOSS ((close-lowest[20](low))/5*4 + LBuffer)
//SET TARGET PROFIT 4.0*ATR + 2*LBuffer //+ LProfitBuffer
ENDIF
“I tested a version of the code where I deleted all references to the 15min and 1hr TF and then trades where taken.”
It means that all conditions on separate TFs cannot be met, They are likely to be very strict.
@robertogozzi : But why are then trades showing up in Backtest. That would mean that the conditions on the other TFs are not met and therefore don’t prevent a trade from being entered?
What’s the value for ContractSize, did you GRAPH it ?
How do I do this?
just append
GRAPH ContractSize
to your code, then backtest it.
Then check what’s its value candle by candle in the variable windows that backtest will open just below the equity curve.
You can append more GRAPH instructions if you want to monitor additional variables.
The ContractSize for the last 1000 units on the 1 Min chart was changing between 24 and 34.
When I setup up the system I just put in the max. contracts to 10. Did that prevent the trades from being taken? I was assuming if the calculated contract size would be bigger than the max. amount, the system then just uses the max. amount I set up.
No, that shouldn’t matter.
But it’s worth while trying with 999 contracts,
Thank you. I’ll try it.
Any other idea what to look for?
I was hoping someone in the forum can help me as the responsiveness of ProRealTime support regarding technical reports is a little bit slow. Last week I got a question regarding a request I sent more than two months ago. And two days later another reply from a request from December last year!
I’be been waiting 4+ months for an answer!
I just put in the max. contracts to 10. Did that prevent the trades from being taken? I was assuming if the calculated contract size would be bigger than the max. amount, the system then just uses the max. amount I set up.
Sacha, as far as my experience goes, this does matter. And no, it won’t do less if you set it to less (normally one would not want that).
Also check the available funds. If they are insufficient nothing will happen (obviously). Here too, it won’t go with less.
No trades executed in Demo Autotrade
This topic contains 11 replies,
has 4 voices, and was last updated by
Nicolas
4 years, 6 months ago.
| Forum: | ProOrder: Automated Strategies & Backtesting |
| Language: | English |
| Started: | 08/10/2021 |
| Status: | Active |
| Attachments: | No files |
The information collected on this form is stored in a computer file by ProRealCode to create and access your ProRealCode profile. This data is kept in a secure database for the duration of the member's membership. They will be kept as long as you use our services and will be automatically deleted after 3 years of inactivity. Your personal data is used to create your private profile on ProRealCode. This data is maintained by SAS ProRealCode, 407 rue Freycinet, 59151 Arleux, France. If you subscribe to our newsletters, your email address is provided to our service provider "MailChimp" located in the United States, with whom we have signed a confidentiality agreement. This company is also compliant with the EU/Swiss Privacy Shield, and the GDPR. For any request for correction or deletion concerning your data, you can directly contact the ProRealCode team by email at privacy@prorealcode.com If you would like to lodge a complaint regarding the use of your personal data, you can contact your data protection supervisory authority.