Pro order different from probacktest
Forums › ProRealTime English forum › ProOrder support › Pro order different from probacktest
- This topic has 41 replies, 5 voices, and was last updated 3 years ago by
PeterSt.
-
-
03/03/2022 at 11:08 PM #18928803/04/2022 at 11:07 AM #189308
Something well weird going on here!!
- If I start the backtest using the button in image 1 … I get image 2 (this button is in the Trading Systems window)
- If I start the backtest using the button in image 3 … I get image 4 (this button is in AutoTrading / Code Editor window)
I do have tick by tick enabled in both 1. and 2. above.
Do you get the same as 1. and 2. above josward1 (or anybody)??
03/04/2022 at 7:14 PM #189353I only ever use the probacktest my system button in the code modification box. But if I open the chart up fresh the backtest will automatically load and produce a similar set of results to the one that lost. I analysed this and I didn’t think it was showing trades taken in line with the strategy. I would then prepare a fresh backtest and it would produce the winning set of results. I have also tested about 10 different parameters also on Wall Street indices and produced winning results. So I didn’t think it was an issue with the strategy it’s self.
but still if the backtest loaded onto a New chart shows the loosing results, but again appeared to be randomly taken trades03/04/2022 at 10:19 PM #189361What I show in my screenshots and same as confirmed by you is an indication that there is something fundamentally wrong with the Algo! You / we may even have uncovered a weakness / bug in PRT!
As my screenshots does not happen with a strategy running correctly!
I’m sure PeterSt will have some more to say, but it’s almost as if the tick by tick mode is working in reverse! You probably don’t know what this means, but more tomorrow hopefully.
03/05/2022 at 4:29 AM #189367I’m sure PeterSt will have some more to say,
Well, he’s intrigued.
At least this Strategy is independent of the “sequence” I mentioned (scalping works too “strict” for it to deviate at the 3 minute interval).First off : a deep hats off to GraHal who has been “able” to find the differentiation by means of using those separate buttons. Without that, no dice ! (and only the winning strategy).
Next, of course an apology to Jos because all I said is not in order / applicable.Then :
When using the button for Preparing the Strategy for AutoTrading, we receive the message in the 2nd attachment, and it tells us to replace the Optimisation Variables with direct assignments in the code. And well, I can’t be 100% sure yet, but it seems to go wrong there. Regarding this, the message should not be there in the first place, that is, not that I know of because PRT will replace them with ONCE assignment in “my” normal situation. So what I am saying is that what you see in the 3rd attachment is a perfectly normal situation to exist, even meant to fill (change) the parameters to the Strategy at handing the Strategy to the AutoTrading system. Thus, I could change LotSize to 15 when I hand it to Autotrading. PRT will make this of it in the top of the code :
1ONCE LotSize = 10or when I changed it to 15 :
1ONCE LotSize = 15All the parameters to the Strategy (yes, it’s “parameters” now) are set like this with ONCE statements. And it is here where something will go bananas, already because this message (2nd attachment) appears. Jos will be doing similar (though possibly (??) not with ONCE statements but normal assignments (LotSize = 10)) and now the Strategy won’t work because the virtual ONCE’s will not be there and a variable may accumulate instead of starting at its initial value at each call when the 3 minute bar is closed.
(hey, this is ad-hoc reasoning 😉 )Because that message should not appear anyway, I think the intelligence of the PRT AutoTrading engine can see in advance that something is ambiguous. This can easily be because of the TimeFrame commands (it is not that, see more below). Regarding this, also notice that the ONCE assignments will (and can only) be inserted at the top of the code, while you might need some to be under an other TimeFrame (like under line 14).
For better understanding of my reasoning, please notice that with normal BackTesting, the ONCE statements will be be there just the same, but we can never see that. When Prepared (for AutoTrading) we can by clicking the link in the window with our Strategies. In this particular case it won’t come that far because the message orders us to inject those statements ourselves. Maybe one, maybe two, maybe all.
Jos, or anyone, I suspect that if you’d insert those statements yourself, there will be a difference between ONCE and the normal assignments. And if PRT would kindly provide a copy-paste facility from the Optimisation Variables, then I would be very happy with it anyway, but I would also have done it myself (no lust to copy them by means of typing and making typo’s, at this time). And Jos, you will already have done that, so you may want to paste them in a next post (or I do it myself anyway because I am too eager for the result).
A year or so back I have created a topic somewhere named “Something is fundamentally wrong with Optimisation Variables” (or something of that order). This is about (for example)
1LotSize = LotSize + 1Giving unpredictable results in the variable itself. Thus, internally this will be
12ONCE LotSize = 10LotSize = LotSize + 1And the system can’t cope with that. However, when *you* insert it like you see right above here, it will be fine.
Lastly … I got the hunch of commenting-out the TimeFrate statements. And wonder oh wonder, the result is exactly the same for both (GraHal’s) buttons. This was not to be expected at least for the winning situation. No change ?? Does Jos recognise that this can be ? (I didn’t look into the functional code itself at all).
1 user thanked author for this post.
03/05/2022 at 10:18 AM #189378Possiblly it comes down to what I wrote over here.
I am as far as the normal BackTest now giving the same results as the one with the “other” button (not the Editor’s one), BUT see below. When I add a dummy Optimsation Variable (all others are now defined in code) I can still see the normal gain of 9450 popping up.
In the 3rd attachment you see me varying LotSize, which behaves as expected. But when clicking any of the result lines, the results are nicely linearly negative again.
It is that I did not have any time for backtesting the past week, or else I would have done something with my own topic (see given link) because it is not workable any more. So this weekend seems to be lost now …
Thus :
- The negative results can also be incurred for by backtesting (just stuff in the code all the Optimasation Variables, with or without ONCE);
- When #1 has been applied, I see no way to let it behave “normal” with actually no clue of what normal would be.
More dangerous : I wondered why nobody mentioned that error message (obtain variables in code etc.), but I just found that despite the message the code is accepted for the AuoTrading ?!? (see inordinate 4:22 times).
Also see next post …
1 user thanked author for this post.
03/05/2022 at 10:33 AM #189384In the 1st attachment you see the hyperlink in the “systems” form I mentioned earlier on. Well :
Earlier today I posed an essay about the ONCE variables in the early days of the “parameters” feature not working out. I scratched that essay (it did not seem relevant). This was about the ONCE variables being injected in front of DefParams statements, which is not allowed (so this was a PRT bug, say 2 years ago). But now look what happened in the (for AutoTrading) Prepared code :
12345678910111213//-------------------------------------------------------------------------// Hoofd code : Nasdaq live PB button//-------------------------------------------------------------------------//v1.1 - the 2 RSi strategies and stochastic strategy to include the MA conditions//defparam cumulateorders=falseONCE LotSize = 10.0ONCE MAstrategy = 1.0ONCE RSI1over1 = 30.0ONCE RSI1over2 = 50.0ONCE RSI1over3 = 69.0[...]The DefParams statement has outrageously been commented out !!!
My essay also mentioned that I lately did not look into the “mapping” of ONCE variables hence the Parameters as I mention(ed) them, because I just don’t use them any more. So I can’t tell since when this bug now is in there. All I know is that somewhere the week before last week things started to behave oddly. And my estimate would be since the version you see below.
It’s good that is is Saturday today and that support phones are closed down. I would be steaming …
What is related is that I already announced another brand-new bug to them, and this was toned down by telling that this can’t have priority because I found it in backtesting (which just doesn’t run any more for me (IB situation). That was about this one. Happens since the same PRT version.
ProRealTime, you mess up badly from so many angles now …
Stop your V12 idiocy when you can’t even get the version from TWO YEARS AGO (V11) under any means of control when it is about AutoTrading.03/05/2022 at 10:54 AM #189386Another interesting observation is this :
The backtest results (see below) are there in e few seconds (2 or 3). However, the last stage of presenting the results (PRT actually applies the same calculation internally for putting all to the screen – waste of time !!) takes abnormally long compared to the situation where all is fine (the Statistics show the same gain as the Optimisation Form). This tells me once again that internally things error out (at least once per 3 minute bar in this case), and that there’s theoretical hope to solve the issue without PRT-Dev *if* we could only find the cause. And that cause will be related to the issue NOT occurring when all the Optimisation Variables are there (like you see in the 2nd attachment).
A very long shot would be that this is related to the Exponential Average function used, of which I again elsewhere described that I could not use that because it was (relatively) too slow for usage in backtesting. So I am working around that for x months now. Back then I did not see that all what is slow is related to erroring-out internally (one of the worst “features” of PRT, also see my descriptions about arrays being ultimately slow, just because YOU do something wrong, PRT not telling you about it).
Rant
Try {
BlablaDoSomethingwrong
catch {
Continue // Happily continue so the user is happy !!
}
End Try }This is seriously how PRT AutoTrading is coded internally. It would allow you to not be a very serious coder and continue without learning too much.
/Rant
03/05/2022 at 10:59 AM #189389tells us to replace the Optimisation Variables with direct assignments in the code.
I think this is a ‘red herring’ as far as problems with this particular Algo in this Topic.
I say above because I just tried with 3 other Algo’s and I get the same error message.
My opinion is that the button shown attached (in the Trading Systems window – see red arrowhead attached) has never been made to work correctly by PRT since the insertion of the ONCE statements in v11.
PS / EDIT
Never made to work, meaning … does not produce the ONCE statements from the variables listed in the Definition of Variables window / Form.
03/05/2022 at 11:12 AM #189392*if* we could only find the cause.
There are loads of ‘zero bars‘ prodiced by this Algo … enter, make profit and exit all on 1 bar. These zero bars do not show as positions under the equity curve.
The Algo uses … set stop ptrailing sl //Line 82 … with sl = 7 . I think this may be partly responsible for some of the weirdness with this Algo??
PS / EDIT
Above is why I mentioned (in a previus post) that it seems like tick by tick disabled – but acting in reverse – gives us all the losing trades and equity curve all below zero.
Tick by tick disabled but acting in reverse, meaning … PRT is counting every trade as if it loses every time if a zero bar. (instead of gaining ever time, which is the normal action for zero bars with tick by tick disabled).
Hope above makes sense. just say if it doesn’t? Another lively Saturday morning this is truning into! 🙂
1 user thanked author for this post.
03/05/2022 at 11:46 AM #189396The Algo uses … set stop ptrailing sl //Line 82 … with sl = 7 . I think this may be partly responsible for some of the weirdness with this Algo??
Haha, I came back to exactly report that.
1Once TrailingStopSize = 0 // 7So change that to 0 and all is fine.
And may I recall my again other written issue (somewhere the past weeks, related to MikeBoorman, but nobody could understand it) that there’s something fishy with the Pending Stop stuff ?
Mind you, eliminating the Pending Stop per
1Once TrailingStopEnable = 0does not help (it works out too differently).
So, salvation is near !
🙂PS: But I would not prefer this version, so now it requires something else for the Pending Stop. –> My (elsewhere proposed) Limit again …
1 user thanked author for this post.
03/05/2022 at 11:57 AM #189398–> My (elsewhere proposed) Limit again …
Or maybe not or else with great care. I mean, since I am using Limit orders for the Exits in my main Strategy, I have similar issues (the first link I referred to today).
03/05/2022 at 12:00 PM #18939903/05/2022 at 2:06 PM #1894021000+ backtests further … 😐
Not any means of StopLoss works out to a normal result. I can feel / sense kind of see it is related to this part of the code :
12345678910111213141516// --- ordersif not longonmarket and (buyc1 or buyc2 or buyc3 or buyc4) thenif range>SignalLargerThan*pointsize thenbuy lotsize contract at high-range*.5 stopelsebuy lotsize contract at marketendifendifif not shortonmarket and (sellc1 or sellc2 or sellc3 or sellc4) thenif range>SignalLargerThan*pointsize thensellshort lotsize contract at low+range*.5 stop // <<----- This is the main culprit !!elsesellshort lotsize contract at market // <<----- ditto (?!?).endifendifbecause *with* that code active it works as a counteract against a lacking SL (which I all removed).
It is way more complicated than I can discretely comprehend myself, and I suspect that the Pending SL conflicts with itself in the next bar. But yet again “or someting like that” because a normal SL also makes it go as bananas. Point is also (as far as I can see) that the Entries are already pending and that nothing depicts that at a next call the same Pending is ordered for (say at bar one it ends up in the If and the next in the Else).What I don’t know : what if a Pending Stop Loss (which is also buying) is combined with a normal SL. Thus
1set stop ploss stoplossdistance // Normal StopLoss.I think this conflicts, or possibly when BackTesting the BackTest Result deals fine with it, while this last step of presenting the Stats does not. And, according to Jos’s findings, Live would also not – it would behave like the Stats.
I don’t know who created this code, but I think it s*cks. Not that nothing can be made of it ! 🙂 🙂
It should be so I learned a few things. One of them could be that the button below (thank you GraHal !) is better representative for the result in Live.03/05/2022 at 2:25 PM #189404I just popped in (from doing outside jobs in the sun!) for a coffee!
It’s surprising how we think alike Peter, I also played around with the same lines of code that you show above. I have 3 versions on Forward Test on Demo.
The 1st 2 versions keep getting rejected (for that multiple times error) anyway I added a snipett to Long and Short (on above code lines) and it made £68 over 3 winning trades yesterday (at £1 per point) ! 🙂 It’s in and out like a flash, either small loss or small profit.
I like a challenge and if I can get an Algo making money even though I can’t understand all the code then that appeals to my psyche! Also the scalping in and out in a few seconds appeals to me!
I reckon we should keep going? I think josward1 paid for the code? If we can get it working and profitable consistently, maybe we should consider putting it on MarketPlace as a ‘3 part joint venture’ . We deserve some return for our efforts?? 🙂
-
AuthorPosts
Find exclusive trading pro-tools on