Strange behaviour of Limit order
Forums › ProRealTime English forum › ProOrder support › Strange behaviour of Limit order
- This topic has 19 replies, 3 voices, and was last updated 8 years ago by Elsborgtrading.
-
-
09/19/2016 at 9:06 PM #13329
Ok, now that I see the rest of the code, that confirms my second message (the one squeezed between my first message and Nicolas’ beers message, it’s easy to miss it because you probably replied to the first one before reading the second one and then read the beer story skipping this second message just before), here is why there is something in the code that generates 102.188 and 102.322 and also why it must be “opening+amplitude”:
With your “opening+amplitude” being more or less = latest close + only 10% of the difference between highest and lowest during previous 4 bars, it has tremendous likelihood to be lower than the target level 1.5% above long position opening level. Less call this part “A”
And whilst manually you could separate a sellshort order from a target limit for a buy long order, PRT won’t try to have positions in both directions, it will only have the net difference between intended long and short positions, that’s already true when cumulate orders is true, it’s even all the more true when cumulate orders is false. So if 1 short is asked when 1 long is already existing, it will decrease 1 long rather than adding 1 short to 1 long like we can force manually in IG. Let’s call this part “B”
Consequently, for any long entry in a candle ending between 22h and 23h, your sellshort pending order (being written immediatly after the buy order) will be considered the target of the existing long order rather than a separate short entry (because of part B) for each time the limit entry level of the short order is lower than the intended target level of the long coming from the “set target” line (and that’s the case, see item A).
So by checking highest and lowest of the 4 candles before your long entry, you’ll most likely see 102.188 and 102.322 are = opening+amplitude.
And as soon as you are in a candle ending after 23h, the if statement is not visited anymore, the sellshort pending order is not there anymore, consequently the long order can now have its proper TP target replacing the previous lower “opening+amplitude” target due to the pending sellshort order.
09/20/2016 at 9:28 AM #13342Hi Noobywan, and thanks for the explaination. I think I need more time to sit down and go over it to understand it fully. But one thing, why is it only the case for TP and not SL? shouldn’t it be the same?
09/20/2016 at 9:52 AM #13347The SL is not changed because there is no sellshort order “below” the market level at time of the long entry price. To take priority over your SL, such order would have been a “sellshort at stop” type of pending order below ongoing market level (and above SL), rather than “sellshort at limit” type of pending order.
09/20/2016 at 10:12 AM #13349In other words, here is what the computer understands from the code in chronological order:
[in any candle matching time>=22h and time <=23h]
The boss (that’s you) wants me to buy, ok I buy
The boss wants me to sellshort at opening+amplitude, ok, but I have bought a long already, and I can’t have long and short at the same time, and even if I could I can’t cumulate orders anyway so I definitly won’t keep the long if I reach that opening+amplitude level, and I won’t sell the long and open a short because that would be selling twice more than what the boss wants, so my only opssible choice is to use “opening+amplitude” as a target for the long
The boss asks me to place SL 0.6% for the long, ok no problem with that
The boss wants me to place target TP of the long, but at the moment I am still in a candle ending <=23h and I already have a target at “opening+amplitude” lower than TP, so I ignore his TP target because if we reach that TP level during on-going candle, I will have already sold the long
[and later, at first candle closing >23h]
I still have that long on-going, and the boss is not asking me to sellshort at opening+amplitude this time, ok I cancel it as a target of the on-going long
Boss wants me to place target at TP for on-going long which just had its previous target cancelled, ok new target for the long is now TP
09/20/2016 at 7:18 PM #13399Okay I follow you. But if the the Long gets filled and reaches the short- it will sell the long and go short.. and place a new limit order @23:00. if the short reaches the new long limit order, it will exitshort and buy long again.. at least that I what I found out last night. Dot really know if this is intended in the original strategy. Anyway you been a real help- thanks:-)
-
AuthorPosts
Find exclusive trading pro-tools on