EXITSHORT not working?
Forums › ProRealTime English forum › ProOrder support › EXITSHORT not working?
- This topic has 4 replies, 3 voices, and was last updated 4 years ago by
Philippo.
-
-
01/23/2021 at 10:59 AM #158971
Hi, I have a trading system which appears not to want to EXITSHORT. Which is clearly very strange. what am i missing here?
Am certain the exitdn condition is triggered as other variables in the if statement are being correctly affected (position is reset to its initial value) and the exitdn boolean is true at the expected time. however the EXITSHORT is not executing: the position size is unaffected and so the position’s losses are unusually large.
I may have read the outcome incorrectly and it is in actual fact executing, but then why is the positionsize not zero?
For BUY, SELL and SELL SHORT the system behaves as expected: overall position size adjusted, new position entry size decreased (the system takes a large initial stake and then decreases new stake position size each time until 1 or the exit is tirggered and so a reset to initial)
On the screenshot we see EURCAD 5min on Friday 22nd Jan at 16:15. At 16:10 the CCI crossed over the 100 line which is an exit short condition in this system. At 16:20 the Positions should have gone down to zero. on the user variables chart the blue variable Position (new entry size) is reset to initial value 5. The variable Xdn is set to 1 indicating an exit down criteria has been met, so the contents of the if condition should all be executed.
I tried with EXITSHORT and with BUY, same inaction both times.
Will keep looking and any suggestions questions welcome 🙂
Thank you.
CCI system1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859myCCI=CCI[20]CCIMA=Average[20](myCCI)initialposition = 5if onmarket thenccimaup = ccima > 70ccimadn = ccima < -70elseccimaup = ccima > 10ccimadn = ccima < -10position = initialpositionendifVup = mycci>mycci[1] and mycci[1] < mycci[2] and mycci>0// \/Vdn= mycci<mycci[1] and mycci[1] > mycci[2]and mycci<0// /\entryup= ccimaup and Vupentrydn= ccimadn and Vdnexitup = myCCI crosses under -100 and longonmarketexitdn = myCCI crosses over 100 and shortonmarketif entryup thenbuy position contract at marketSET STOP TRAILING SAR[0.02,0.02,0.09]if position >1 thenposition = position -1endifendifif entrydn thenSELLSHORT position contract at marketSET STOP TRAILING SAR[0.02,0.02,0.09]if position >1 thenposition = position -1endifendifGRAPH exitup*-1 coloured (255,0,0) as "Xup"GRAPH exitdn coloured (155,0,0) as "Xdn"GRAPH entryup coloured (0,255,0) as "UP"GRAPH entrydn*-1 coloured (0,200,0)as "DN"GRAPH position coloured (0,0,200) as "Position"if exitup thenSELL COUNTOFPOSITION contract at marketposition = initialpositionendifif exitdn thenEXITSHORT COUNTOFPOSITION contract at market//BUY COUNTOFPOSITION contract at marketposition = initialpositionendif01/23/2021 at 11:06 AM #15897701/23/2021 at 4:26 PM #159082this is expected, the position builds with decreasing stakes, so 16=5+4+3+2+1+1 for a total of six entries as the favourable wind continues…
if the wind changes and the stoploss is triggered, everything appears ok. Well at least it triggers.
The problem I have is that this position of 16, when the exit criteria are met, does not execute the EXITSHORT.
at 2030 on your attachment I see an exit long signal on the variables, so SELL happens and the position is reset. But looking earlier you will see two exit short (red /\ on the variables graph) but the position size keeps growing. It should be same as exit long: BUY and position is reset. why no buy?
Thanks
01/23/2021 at 4:55 PM #159095Instead of using COUNTOFPOSITION, which can be negative, use:
1abs(COUNTOFPOSITION)to make it positive.
1 user thanked author for this post.
01/24/2021 at 11:08 AM #159178 -
AuthorPosts
Find exclusive trading pro-tools on