No entry after not working?
Forums › ProRealTime English forum › ProOrder support › No entry after not working?
- This topic has 10 replies, 2 voices, and was last updated 4 years ago by
egyptiantrader.
-
-
09/24/2021 at 1:20 PM #178303
I’ve added some no entry code (straight from the simplified creation tool in bold below) but its having no effect even when I change the time so I’m trading from 8 hrs to less than an hour a day? Trades are still showing in back test after the no entry time?
No idea why this isn’t working?
Help please.
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// The system will cancel all pending orders and close all positions at 0:00. No new ones will be allowed until after the “FLATBEFORE” time.
DEFPARAM FLATBEFORE = 143500
// Cancel all pending orders and close all positions at the “FLATAFTER” time
DEFPARAM FLATAFTER = 220000// Prevents the system from placing new orders to enter the market or increase position size after the specified time
noEntryAfterTime = 145500
timeEnterAfter = time < noEntryAfterTime// Prevents the system from placing new orders on specified days of the week
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 009/24/2021 at 2:45 PM #178310These two commands:
- DEFPARAM FLATBEFORE = 143500
DEFPARAM FLATAFTER = 220000
mean that you do NOT want any trade open before 143500 AND after 220000.
This further instruction:
- noEntryAfterTime = 145500
timeEnterAfter = time < noEntryAfterTime
means that you can enter a trade BEFORE 145500 (but AFTER 143500 as from above).
So your trades can only be opened between 143500 AND 145459.
If you trade on a 15-minute TF you can only enter at 144500. On a higher TF no trade will ever be opened.
In any case at 220000 ALL trades will be closed.
09/24/2021 at 3:32 PM #178313Yes I agree with what you have said but that’s not how the back test results are working. I’m on a 5m timeframe and only adjusted the noentrytime to 14:55 test it. I’m seeing no effect no matter what time I enter?
See attached results:
One image is the results with no restriction on entry between 14:35 and 22:00
The other is image is as above but no entries allowed after 16:00.
There’s no difference when they definitely should be?
09/24/2021 at 6:55 PM #178329To check results I need the working code in order to be able to replicate your trades.
09/27/2021 at 9:48 AM #178540//————————————————————————-
// Main code : EMA cross over DOW £1
//————————————————————————-
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// The system will cancel all pending orders and close all positions at 0:00. No new ones will be allowed until after the “FLATBEFORE” time.
DEFPARAM FLATBEFORE = 143500
// Cancel all pending orders and close all positions at the “FLATAFTER” time
DEFPARAM FLATAFTER = 220000//// Prevents the system from placing new orders to enter the market or increase position size after the specified time
//noEntryAfterTime = 160000
//timeEnterAfter = time < noEntryAfterTime// Prevents the system from placing new orders on specified days of the week
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0////stops trades within x bars after exit
//ONCE BarCount = 0
//ONCE TradeON = 1 //1=trading allowed 0=trading disbaled
//IF OnMarket AND Not OnMarket[1] THEN
//TradeON = 0 //disable trading
//BarCount = 0 //reset counter
//ENDIF
//IF Not OnMarket THEN //Increase counter when not on market
//BarCount = BarCount + 1
//ENDIF
//IF BarCount > 3 THEN
//TradeON = 1
//ENDIF//Initial balance
myBalance5mDOW = CALL “Balance 5m DOW”If Time = 143000 then
upper=highest[6](high)
lower=lowest[6](low)
endif//Conditions to enter long positions
indicator1 = ExponentialAverage[shortT](close)
indicator2 = ExponentialAverage[longT](close)
c1 = (indicator1 CROSSES OVER indicator2)IF close >upper AND c1 AND myBalance5mDOW <minibalance AND not daysForbiddenEntry THEN
BUY 0.5 CONTRACT AT MARKET
ENDIF// Conditions to exit long positions
indicator3 = ExponentialAverage[shortT](close)
indicator4 = ExponentialAverage[longT](close)
c2 = (indicator3 CROSSES UNDER indicator4)IF open <upper -5 OR C2 THEN
SELL AT MARKET
ENDIF//Conditions to enter SHORT positions
indicator1 = ExponentialAverage[shortT](close)
indicator2 = ExponentialAverage[longT](close)
c3 = (indicator1 CROSSES UNDER indicator2)IF c3 AND close <lower AND not daysForbiddenEntry THEN
SELLSHORT 0.5 CONTRACT AT MARKET
ENDIF// Conditions to exit short positions
indicator3 = ExponentialAverage[shortT](close)
indicator4 = ExponentialAverage[longT](close)
c4 = (indicator3 CROSSES OVER indicator4)IF open >lower +5 OR C4 THEN
EXITSHORT AT MARKET
ENDIFSET STOP pLOSS (stoploss)
SET TARGET pPROFIT (TP)09/27/2021 at 9:52 AM #178542The section is commented out at the moment above.
//// Prevents the system from placing new orders to enter the market or increase position size after the specified time
//noEntryAfterTime = 160000
//timeEnterAfter = time < noEntryAfterTimeThanks.
09/27/2021 at 11:17 AM #178549It must be a working code.
It’s missing:
- indicator “Balance 5m DOW”
- longT
- minibalance
- shortT
- stoploss
- TP
09/27/2021 at 12:24 PM #178554//Balance 5m DOW
//Initial Ballance calculationstarttime = 133000
endtime = 143000If Time = endtime then
upper=highest[6](high)
lower=lowest[6](low)
dif=round(abs(lower-upper))endif
DRAWHLINE (BB) coloured(0,200,0)
DRAWHLINE (SB)coloured(200,0,0)RETURN dif
09/27/2021 at 12:26 PM #178556- longT =18
- minibalance = 110
- shortT = 13
- stoploss = 35
- TP = 450
09/27/2021 at 5:13 PM #178585Ok, I see, it’s because you need to add AND timeEnterAfter to your entry conditions, so that they read:
12IF close >upper AND c1 AND myBalance5mDOW <minibalance AND not daysForbiddenEntry AND timeEnterAfter THENIF c3 AND close <lower AND not daysForbiddenEntry AND timeEnterAfter THEN1 user thanked author for this post.
09/27/2021 at 6:05 PM #178592Thank you. I’ll give that a go.
- DEFPARAM FLATBEFORE = 143500
-
AuthorPosts
Find exclusive trading pro-tools on