Orders are closing as soon as they are opened
Forums › ProRealTime English forum › ProOrder support › Orders are closing as soon as they are opened
- This topic has 21 replies, 5 voices, and was last updated 5 years ago by Nicolas.
-
-
08/15/2018 at 11:13 AM #78255
Line 29 is not allowed (despite being documented), you cannot combine two kind of SL at the same time and, if you separate them on two lines the second line will overwrite the previous one!
Your right I do apologise as I compared indicator 1 against indicator 1- when it should of been indicator 2. However I fixed this issue. So just to confirm the error is on the automated coding level and not at the indicator level ?
Further I am using the 10 minute time frame. As you can see on the attachments
Even when using the simplified creation tool(code below) I get the same error of orders closing as soon they they are placed.
1234567891011121314151617181920212223242526272829// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// Prevents the system from creating new orders to enter the market or increase position size before the specified timenoEntryBeforeTime = 143000timeEnterBefore = time >= noEntryBeforeTime// Prevents the system from placing new orders to enter the market or increase position size after the specified timenoEntryAfterTime = 210000timeEnterAfter = time < noEntryAfterTime// Conditions to enter short positionsindicator2, indicator1 = CALL aSpecc1 = (indicator1 >= indicator2)IF c1 AND timeEnterBefore AND timeEnterAfter THENSELLSHORT 4 PERPOINT AT MARKETENDIF// Conditions to exit short positionsindicator4, indicator3 = CALL aSpecc2 = (indicator3 CROSSES UNDER indicator4)IF c2 THENEXITSHORT AT MARKETENDIF// Stops and targetsSET STOP pTRAILING 14Thanks again for all the input.
Regards,
Simeon
08/15/2018 at 11:37 AM #78264It seems to be working perfectly, always exiting due to the TRAILING stop. I embedded the indicator in the strategy (but this shouldn’t affect results):
1234567891011121314151617181920212223242526DEFPARAM CumulateOrders = False // Cumulating positions deactivatedcurrentHigh=High[0]previousHigh=High[1]currentClose=close[0]diffCurrentVSPreviousHigh=previousHigh-currentCloseIF currentHigh>previousHigh THENrisingHigh=12elserisingHigh=2ENDIF//return risingHigh,diffCurrentVSPreviousHighnoEntryBeforeTime = 143000timeEnterBefore = time >= noEntryBeforeTimenoEntryAfterTime = 210000timeEnterAfter = time < noEntryAfterTimeindicator2 = diffCurrentVSPreviousHighindicator1 = risingHighc1 = (indicator1 >= indicator2)c2 = (indicator1 CROSSES UNDER indicator2)IF c1 AND timeEnterBefore AND timeEnterAfter THENSELLSHORT 4 PERPOINT AT MARKETENDIFIF c2 and shortonmarket THENEXITSHORT AT MARKETENDIFSET STOP pLOSS 20 pTRAILING 141 user thanked author for this post.
08/15/2018 at 12:27 PM #78275Hi Roberto,
I cant thank you enough. Its great to know that my code works.
When I did go through the losers , It seems the issue is still somewhat present as can be seen in the attachment below(I am not sure how clear it is so I have also typed them out below).
Considering that the code works from a technical standpoint. Is this just a byproduct of the code(sometimes it will close orders as soon as they are opened) ?
1 August OPEN: 20:50 CLOSE:20:50
2 August OPEN: 14:50 CLOSE:14:50
2 August OPEN: 15:00 CLOSE:15:00
2 August OPEN: 17:40 CLOSE:17:40
2 August OPEN: 17:50 CLOSE:17:50
2 August OPEN:18:40 CLOSE:18:40
Regards,
Simone
P.S the 2nd attachment showing a chart on IG shows the corresponding price for the 2 August 17:40 close out. As I believe the order shouldn’t of closed as on the following 3 candles the current high is lower than the previous high.
08/15/2018 at 12:52 PM #78280It works perfectly, I rarely experienced 0-bar trades, some are those you posted, but all of then are closed due to trailing stop.
08/15/2018 at 4:17 PM #78289Hi Roberto,
You are right. When I take away the ptrailing the orders don’t seem to close straight away.
But as a trader it is very very rare for a stop to be hit in a second. ptrailing is points correct(because i set ‘ptrailing’ at 20 pips away from buy price) ?
Anyway I thought it best to remove the ptrailing and find another solution as stops/limits seems to do more harm than good.
Regards,
08/15/2018 at 4:28 PM #78290But as a trader it is very very rare for a stop to be hit in a second. ptrailing is points correct(because i set ‘ptrailing’ at 20 pips away from buy price) ?
Yes, right.
- $Trailing = sets trailing stop in units of your currency
- Trailing = sets trailing stop as a difference in price (say 0.0015) away from the price
- pTrailing = sets trailing stop as a number of pips (say 15) away from the price
08/15/2018 at 5:11 PM #78296 -
AuthorPosts
Find exclusive trading pro-tools on