Hi Nicolas
I agree with your suggestion. May I know how to modify my coding in the EA?
All the while I am using ‘Simplified Creation, mode to setup an EA.
I am not good in coding. May I know where can I learn a proper coding lesson in Probuilder?
You can restrain the trading to market hours (set starttime and endtime in the code), with this version of the code (copy/paste from GraHal version):
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
starttime=080000
endtime=180000
tcondition=time>=starttime and time<endtime
if tcondition then
// Conditions to enter long positions
indicator1 = Average[1](DI[14](close))
c1 = (indicator1 CROSSES OVER -40)
indicator2 = Momentum[12](close)
c2 = (indicator2 <= -350)
indicator3 = CCI[20]
c3 = (indicator3 < -95)
IF c1 AND c2 AND c3 THEN
BUY 1 PERPOINT AT MARKET
ENDIF
// Conditions to enter short positions
indicator5 = Average[1](DI[14](close))
c5 = (indicator5 CROSSES UNDER 10)
indicator6 = Momentum[12](close)
c6 = (indicator6 <= 33)
indicator7 = Volume
c7 = (indicator7 <= 1300)
indicator8 = Volume
c8 = (indicator8 >= 100)
indicator9 = ExponentialAverage[9](MACDline[12,26,9](close))
indicator10 = MACDline[12,26,9](close)
c9 = (indicator9 <= indicator10)
indicator11 = Average[5](volume)-Average[25](volume)
c10 = (indicator11 >= -300)
indicator12 = AverageTrueRange[14](close)
c11 = (indicator12 >= 12)
indicator13 = Stochastic[14,3](close)
c12 = (indicator13 < 88)
indicator14 = ExponentialAverage[9](MACDline[12,26,9](close))
indicator15 = MACDline[12,26,9](close)
c13 = (indicator14[1] < indicator15[1])
indicator16 = ExponentialAverage[9](MACDline[12,26,9](close))
indicator17 = MACDline[12,26,9](close)
c14 = (indicator16[2] < indicator17[2])
c15 = (close < close[1])
indicator18 = MoneyFlowIndex[14]
c16 = (indicator18 <= 75)
indicator19 = MoneyFlowIndex[14]
c17 = (indicator19 >= 40)
indicator20 = Momentum[12](close)
c18 = (indicator20 >= 20)
IF c5 AND c6 AND c7 AND c8 AND c9 AND c10 AND c11 AND c12 AND c13 AND c14 AND c15 AND c16 AND c17 AND c18 THEN
SELLSHORT 1 PERPOINT AT MARKET
ENDIF
endif
// Conditions to exit long positions
indicator4 = SAR[0.02,0.02,0.2]
c4 = (close CROSSES UNDER indicator4)
IF c4 THEN
SELL AT MARKET
ENDIF
// Conditions to exit short positions
indicator21 = SAR[0.02,0.02,0.2]
c19 = (close CROSSES OVER indicator21)
IF c19 THEN
EXITSHORT AT MARKET
ENDIF
(not tested)
Hi Nicolas
Thank you for your kind advice.
Do you know where can we have a proper and complete way to learn the Probuilder coding? Is there any coding course specific for Probuilder?
Hi Nicolas
Thank you for your information.
Hi, guys.
I am having the same problem of auto stopped from Proorder although I have added the code DEFPARAM PreLoadBars = 20000.
This EA is for Hong Kong (A$1) market with 15 min timeframe. It generates good result on the backtest.
//————————————————————————-
// Main code : hk15m C>YC CcoOmfiP95L100-2(1)
//————————————————————————-
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
DEFPARAM PreLoadBars = 20000
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 091500
timeEnterBefore = time >= noEntryBeforeTime
// Conditions to enter long positions
c1 = (close >= DClose(1))
c2 = (close CROSSES OVER DOpen(0))
indicator1 = ADX[14]
c3 = (indicator1 > indicator1[1])
indicator2 = DIplus[14](close)
c4 = (indicator2 >= 26)
indicator3 = MoneyFlowIndex[14]
c5 = (indicator3 < 50)
indicator4 = Average[5](volume)-Average[25](volume)
c6 = (indicator4 <= 8500)
indicator5 = ADX[14]
c7 = (indicator5 >= 14)
indicator6 = Average[5](Stochastic[14,3](close))
c8 = (indicator6 >= 35)
IF (c1 AND c2 AND c3 AND c4 AND c5 AND c6 AND c7 AND c8) AND timeEnterBefore THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Conditions to enter short positions
c9 = (close < DClose(1))
c10 = (close CROSSES UNDER DOpen(0))
indicator7 = ADX[14]
c11 = (indicator7 < indicator7[1])
indicator8 = ADX[14]
c12 = (indicator8[1] < indicator8[2])
indicator9 = CCI[20]
c13 = (indicator9 < -90)
indicator10 = CCI[20]
c14 = (indicator10 > -200)
indicator11 = ADX[14]
c15 = (indicator11 >= 13)
indicator12 = DI[14](close)
c16 = (indicator12 <= 0)
indicator13 = Average[5](volume)-Average[25](volume)
c17 = (indicator13 < 8500)
indicator14 = Average[5](volume)-Average[25](volume)
c18 = (indicator14 >= 500)
indicator15 = Volume
c19 = (indicator15 > 2500)
indicator16 = MoneyFlowIndex[14]
c20 = (indicator16 > 10)
indicator17 = Average[5](Stochastic[14,3](close))
c21 = (indicator17 > 10)
indicator18 = Momentum[12](close)
c22 = (indicator18 <= -25)
IF (c9 AND c10 AND c11 AND c12 AND c13 AND c14 AND c15 AND c16 AND c17 AND c18 AND c19 AND c20 AND c21 AND c22) AND timeEnterBefore THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
// Stops and targets
SET STOP pLOSS 100
SET TARGET pPROFIT 100
Hi guys.
Another EA with the same problem of auto stopped out from Proorder.
This EA is for Hong Kong (A$1) with 15 min timeframe.
//————————————————————————-
// Main code : hk15mCcoYHcuYLmovoP100L105-(1)
//————————————————————————-
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
DEFPARAM PreLoadBars = 10000
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 091500
timeEnterBefore = time >= noEntryBeforeTime
// Conditions to enter long positions
c1 = (close CROSSES OVER DHigh(1))
indicator1 = DIplus[14](close)
c2 = (indicator1 > 12)
indicator2 = MACDline[12,26,9](close)
c3 = (indicator2 > 0)
indicator3 = Momentum[12](close)
c4 = (indicator3 > 25)
indicator4 = MoneyFlowIndex[14]
c5 = (indicator4 < 80)
indicator5 = CCI[20]
c6 = (indicator5 < 200)
indicator6 = Momentum[12](close)
c7 = (indicator6 < 75)
indicator7 = ADX[14]
c8 = (indicator7 > 22)
indicator8 = AverageTrueRange[14](close)
c9 = (indicator8 > 28)
indicator9 = Average[5](volume)-Average[25](volume)
c10 = (indicator9 <= 3300)
indicator10 = AverageTrueRange[14](close)
c11 = (indicator10 < 58)
indicator11 = Average[5](volume)-Average[25](volume)
c12 = (indicator11 >= -400)
indicator12 = CCI[20]
c13 = (indicator12 > 0)
IF (c1 AND c2 AND c3 AND c4 AND c5 AND c6 AND c7 AND c8 AND c9 AND c10 AND c11 AND c12 AND c13) AND timeEnterBefore THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Conditions to enter short positions
c14 = (close CROSSES UNDER DLow(1))
indicator13 = Stochastic[14,3](close)
c15 = (indicator13 < 50)
indicator14 = ExponentialAverage[9](MACDline[12,26,9](close))
c16 = (indicator14 < 0)
indicator15 = Momentum[12](close)
c17 = (indicator15 < -100)
indicator16 = AverageTrueRange[14](close)
c18 = (indicator16 >= 55)
indicator17 = Average[5](volume)-Average[25](volume)
c19 = (indicator17 <= 7500)
indicator18 = Momentum[12](close)
c20 = (indicator18 >= -145)
IF (c14 AND c15 AND c16 AND c17 AND c18 AND c19 AND c20) AND timeEnterBefore THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
// Stops and targets
SET STOP pLOSS 105
SET TARGET pPROFIT 100
Another one with the same problem of auto stopped.
This EA is for Hong Kong (A$1) with 15 min timeframe.
//————————————————————————-
// Main code : hk15m MFIco70 cu20mostPL100(1)
//————————————————————————-
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
DEFPARAM PreLoadBars = 20000
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 091500
timeEnterBefore = time >= noEntryBeforeTime
// Conditions to enter long positions
indicator1 = MoneyFlowIndex[14]
c1 = (indicator1 >= 80)
indicator2 = AverageTrueRange[14](close)
c2 = (indicator2 < indicator2[1])
indicator3 = Average[5](volume)-Average[25](volume)
c3 = (indicator3 < -1500)
indicator4 = MACDline[12,26,9](close)
indicator5 = ExponentialAverage[9](indicator4)
c4 = (indicator4 < indicator5)
c5 = (close >= close[1])
indicator6 = MoneyFlowIndex[14]
c6 = (indicator6 CROSSES OVER 70)
indicator7 = CCI[20]
c7 = (indicator7 > -80)
indicator8 = Stochastic[14,3](close)
c8 = (indicator8 > 45)
IF (c1 AND c2 AND c3 AND c4 AND c5 AND c6 AND c7 AND c8) AND timeEnterBefore THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Conditions to exit long positions
indicator9 = MoneyFlowIndex[14]
c9 = (indicator9 CROSSES OVER 90)
IF c9 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
indicator10 = MoneyFlowIndex[14]
c10 = (indicator10 CROSSES UNDER 20)
indicator11 = Stochastic[14,3](close)
c11 = (indicator11 >= 0)
indicator12 = Stochastic[14,3](close)
c12 = (indicator12 <= 40)
indicator13 = MoneyFlowIndex[14]
c13 = (indicator13 < 15)
indicator14 = MoneyFlowIndex[14]
c14 = (indicator14 >= 10)
indicator15 = Average[5](volume)-Average[25](volume)
c15 = (indicator15 >= -4200)
indicator16 = Momentum[12](close)
c16 = (indicator16 < -105)
indicator17 = Momentum[12](close)
c17 = (indicator17 > -160)
indicator18 = CCI[20]
c18 = (indicator18 >= -300)
indicator19 = Volume
c19 = (indicator19 > 0)
indicator20 = ADX[14]
c20 = (indicator20 <= 65)
IF (c10 AND c11 AND c12 AND c13 AND c14 AND c15 AND c16 AND c17 AND c18 AND c19 AND c20) AND timeEnterBefore THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
// Conditions to exit short positions
indicator21 = MoneyFlowIndex[14]
c21 = (indicator21 CROSSES UNDER 10)
IF c21 THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets
SET STOP pLOSS 100
@kkkok288
>> For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text from the code part! Thank you! << 🙂
I think your Issues / Rejects stem from the ‘unusual conditions’ relating to Volume, for example …
It’s just a hunch, so I may be wrong?
indicator15 = Average[5](volume)-Average[25](volume)
c15 = (indicator15 >= -4200)
indicator19 = Volume
c19 = (indicator19 > 0)
Hi, Grahal
I have used the condition for other EAs in DJI market and there is no problem of auto stopped.
This problem only happens in Hong Kong market.
Do you try to put it run in demo mode?
I have 10 other EAs in Hong Kong market having this problem although the EAs can generate more than 90% winning rate.
DEFPARAM PreLoadBars = 20000 is reset automatically to 10000, this being the maximum allowed.
Do you try to put it run in demo mode?
How often do they take trades?
If trade often (> 1 per day) then yes, I would try for you in Demo and make changes to code if rejected, but I get impatient and need the demo space for other Systems.
I got your us15m DImaccimovoatr testcfd3 to trade once … do you get rejects on that System always / 100% of the time??