One-time buy Signal at System Start
Forums › ProRealTime English forum › ProOrder support › One-time buy Signal at System Start
- This topic has 45 replies, 6 voices, and was last updated 1 month ago by PeterSt.
-
-
11/05/2024 at 12:46 PM #23998211/05/2024 at 1:01 PM #23998411/05/2024 at 1:04 PM #239985
<span class=”bbp-author-name”>stalba</span> it appears that PreLoadbars = 36 is critical if ‘NOT onMarket’ is used. You use period of 36 in your SuperTrend, hence PreLoadbars = 36 is critical I guess.
Or it appears you could miss out ‘NOT onMarket’ and use PreLoadbars = 100 / whatever … as I posted above … unless anyone has good reason not to do this??
EDIT/ PS
I saw JS last post after I posted mine.
1 user thanked author for this post.
11/05/2024 at 1:32 PM #239987Seems to work now, like you both said either with “36 bars + NOT ONMARKET” or e.g. “100 Bars without NOT ONMARKET”, but I guess if 36 bars are enough, I’d go with the “NOT ONMARKET” version. Next, I will test it with a 1-day timeframe – thanks! 🙏🏼
1 user thanked author for this post.
11/05/2024 at 3:25 PM #239989Without trying the code : I bet you that this is because the code has ran several times in live before the PreLoadBars have passed. Thus, have those at 100 and the code will be run 100 times and EntryFlag has turned 1 long gone …
The catch here is that during the PreLoadBars stage the ProOrder commands are NOT executed. Thus no Buy and no Sell or anything.
Years ago I reported this as a severe bug. I myself don’t notice any more that this is still present. Because see below …
1234567891011PreLoadBars = 1000PreLoadBarsSet = 1000 // Set this redundantly to the line above.[...][...]If BarIndex > PreloadBarsSet then[...] // All of your code here - especially the code which determines and does trading.endif… which is what I apply always since.
During Backtesting this is applied differently by PRT, because there the code is NOT run during the PreLoadBars stage.
11/05/2024 at 8:53 PM #24000411/05/2024 at 9:13 PM #240007Apologies @PeterSt but are you saying the feature of having to wait for 1000 preloadbars (in this case) before anything is executed by an auto-trader – can be managed (overcome) by the code you’ve kindly shared.
I feel I’m missing the devil in the detail a little and you’re not saying that entirely but that’s how it’s reading to me (the uninitiated)
PreLoadBarsSet = 1000
and
If BarIndex > PreloadBarsSet then
I have seen you post this before where preloads have been discussed.
Seeking a little clarity here, if this is the case and how it relates to backtest, demo and live.
11/05/2024 at 11:29 PM #240014I think what you said was in the context of this – specific – discussion, where the OP was not seeing triggers for reasons X and how that relates to bars elapsed with respect to preloads and indicator code employed. Your code simply eliminates erroneous triggers and perhaps outcomes given the dataset hasn’t reached required size.
Bit of a waffle there, pls correct if I’ve borked it …
11/05/2024 at 11:55 PM #240015What is below for on Lines 4 and 5?
[…][…]That would typically be the calculation of MACDs and all that *require* the preloaded bars (or else them preloaded bars would be in vain 🙂 ).
1 user thanked author for this post.
11/06/2024 at 12:04 AM #240016I think what you said was in the context of this – specific – discussion, where the OP was not seeing triggers for reasons X and how that relates to bars elapsed with respect to preloads and indicator code employed. Your code simply eliminates erroneous triggers and perhaps outcomes given the dataset hasn’t reached required size.
Bit of a waffle there, pls correct if I’ve borked it …
I hope we’re on the same terms with :
A lot can be done in the code with setting flags etc. etc. etc., that code assuming that a Buy at Market (etc.) would have done so. Thus :
123456Once IAmIn = 0 // Mind the Once.If MyBuyCon = 1 thenBuy x Shares at Market // This will not execute when the preloadbars (say 1000) are executed and the code is called a 1000 times.IAmIn = 1 // This is totally unreliable now for the next iteration.endifSadly, in Backtest this can not be noticed and all goes fine.
Please beware : I never use(d) Demo, so I cannot tell whether Demo will show the same behavior as I have testified (towards PRT) for Live. But I assume it is the same, and with that the cause for the off behavior shown in this thread. GraHal actually showcased it accidentally (in any event well done !).
11/08/2024 at 8:28 AM #240090Hi again,
I’ve been testing several strategies on different instruments over the last two days, but on a 1-day timeframe (which is my goal here), no positions are being opened. One strategy got canceled with a message from PRT suggesting to increase the PreLoadBars. I set it to 10000, but still no positions opened on the next candle. I’ve tested these same systems on 1-minute and 5-minute timeframes, and they worked perfectly. Does anyone know what might be causing the issue with the 1-day timeframe?
One of the codes I’ve tested (with MBTC) is this one:
1234567891011121314151617181920212223242526272829// Set code parametersDEFPARAM CumulateOrders = False // Prevents multiple entriesDEFPARAM PreLoadBars = 10000PreLoadBarsSet = 10000 // Set this redundantly to the line aboveONCE EntryFlag = 0 // Initialization for one-time entrysuperTrendValue = SuperTrend[5.4,36]IF BarIndex > PreloadBarsSet THEN// Check if there is no position at the start and EntryFlag is 0IF NOT ONMARKET AND EntryFlag = 0 THENBUY 1 CONTRACT AT MARKETENDIF// Long ConditionsIF NOT LONGONMARKET and close CROSSES OVER superTrendValue THENBUY 1 CONTRACT AT MARKET // Long EntryEntryFlag = 1 // Set the flag to avoid re-triggeringELSIF LONGONMARKET and close CROSSES UNDER superTrendValue THENSELL AT MARKET // Long ExitEntryFlag = 1 // Set the flag to avoid re-triggeringENDIF// Short ConditionsIF NOT SHORTONMARKET AND close CROSSES UNDER superTrendValue THENSELLSHORT 1 CONTRACT AT MARKET // Short EntryEntryFlag = 1 // Set the flag to avoid re-triggeringELSIF SHORTONMARKET and close CROSSES OVER superTrendValue THENEXITSHORT AT MARKET // Short ExitEntryFlag = 1 // Set the flag to avoid re-triggeringENDIFENDIF11/08/2024 at 12:07 PM #24009511/10/2024 at 9:50 PM #24022611/11/2024 at 12:28 AM #24022711/11/2024 at 6:46 PM #240245Yes, I’m honestly a bit lost here — as I find it hard to believe that no one else is using a trading system for futures… from what I understand, the PreLoadBars are necessary for any kind of indicator to work properly, right? I’ve developed a few systems over the past couple of months that showed promising results, but now they won’t work in ProOrder futures auto trading.
-
AuthorPosts
Find exclusive trading pro-tools on