ZZ-MACD Lookback (or others) in Auto-Systems
Forums › ProRealTime English forum › ProOrder support › ZZ-MACD Lookback (or others) in Auto-Systems
- This topic has 13 replies, 3 voices, and was last updated 7 months ago by JS.
-
-
04/19/2024 at 1:09 AM #231674
Hi Everyone,
How closely aligned is Nicolas’s code to what’s not possible w/in a auto-system.
https://www.prorealcode.com/topic/creer-un-indicateur-zigzag-avec-des-haut-et-bas-du-macd/
123456789101112131415161718192021222324252627282930313233343536373839defparam drawonlastbaronly=truei = MACD[12,26,9](close)if i crosses over 0 thenhhbar=barindexj=j+1elsif i crosses under 0 thenllbar=barindexj=j+1endifif i > 0 thenhhperiod=max(1,barindex-hhbar)$hhbar[j]=barindex[highestBars[hhperiod]]$hh[j]=highest[hhperiod](high)$dir[j]=1endifif i < 0 thenllperiod=max(1,barindex-llbar)$llbar[j]=barindex[lowestBars[llperiod]]$ll[j]=lowest[llperiod](low)$dir[j]=-1endifif islastbarupdate thenfor x=0 to j doif $dir[x] = 1 thendrawtext($hh[x],$hhbar[x],$hh[x],dialog,bold, 12)drawarrowdown($hhbar[x],$hh[x]) coloured("red")endifif $dir[x] = -1 thendrawtext($ll[x],$llbar[x],$ll[x],dialog,bold, 12)drawarrowup($llbar[x],$ll[x]) coloured("green")endifnextendifreturn<hr />
Within PRT doc. the following statement is made:
https://www1.prorealtime.com/en/pdf/probacktest.pdf#breakout
Page 58
Indicator restrictions
The following indicators may not be used for automatic trading because their mode of calculation does not
allow for real-time usage:ZigZag: signals based on this indicator are recalculated after the fact and as a result, the signals given
in real-time may be very different from signals given during backtests.ZigZagPoint
DPO
<hr />
Just want to caveat (and ask) whether something similar (or other indicators), can-could be employed as a retrospective ‘lookback’ along with other ‘realtime’ indicators in defining Long-Short Conditions.
If doable (or not) w/in an auto-system, are there any other gotchas regarding length of code when constructing lookback variables?
From a quick read around I think lookbacks have a 254 bar? limit (I think).
As a guess a ‘call’ could also be initiated to cleanup the code perhaps and allow some specific pre-caning to exist across different sectors/instruments, not only with this but other types of indicators (sto, wr% etc).
<hr />
I know (thanks to Roberto) you can lookback on ema:
https://www.prorealcode.com/topic/the-problem-of-programme-language/
But I’m a little unsure about whether the ‘value-add’ that’s wrapped around the code provided by Nicolas above meets criteria and is acceptable given it’s ‘zig-zag-like’ qualities.
Apologies if this is all so-so for you all, only getting my head around what I see and whether some of it can marry with what PRT offers. EDU journey for me.
Feedback either side of the coin’s always appreciated!
Cheers,
inv
04/19/2024 at 7:06 PM #231711Hi Inverse,
This code falls under the same category as the “Zig Zag”, values of the MACD are recorded in arrays and at the end of a period it is determined which is the highest or lowest values… I don’t think it’s suitable for auto trading.
I think that this indicator is indeed well suited as a “retrospective lookback”, possibly together with other indicators, but only for manual trading…
I think that the 254 bar limit is about screeners…
04/20/2024 at 4:24 AM #231714Thanks JS.
Seeing ~50% packetloss out to EU atmo so can’t say more specifically. PRT is almost dead for some providers out AUS re: cable cuts and the like. Workarounds being put in motion.
What I’ve done is doc. what I do, to pass onto another family member. I’ve pumped what could be useful into a ‘dashboard’, thankyou Nicolas, so they can focus for short periods of time during our evenings (alongside me), with what might be of use to them (maybe). I’m a no indicator type of person for the most part, so finding a bit of relevant granular activity has been tricky, reverse engineering your ideas and have them marry with an indicator is complicated for me. It’s a project so I’ll continue on. Having said that we’re almost 400ms away right now and with ~50% PL, so could be short lived, perhaps VPN, alternate AU-NA paths, who knows…..
Can the MACD values be stored otherwise would be the next question of could you for example, lookback and calc 30days or 14days for example, perhaps even 7, the TF would need to be 1min or 10s even.
Learning as I go so all comments are welcome. I also need to utilise search and perhaps the library snippets (Manual plus pinned topics) to see whether I can dig out alternate / additional ways forward.
Learning curves.
04/20/2024 at 5:03 AM #231715Inv, at lest to me it is unclear whether you talk about autotrading regarding this subject, or about manual trading. I mean, how can the (400ms) delay be related to autotrading ? (all happening on the servers over here)
If it is about teaching to trade your family member, then it’s clear. Well, sort of. I don’t think I personally would be bothered by some delay as pending orders would be applied anyway, almost always. And that does not require sub-ms response (from me !).Your autotrading doesn’t require your PC to be On, am I right ?
04/20/2024 at 5:53 AM #231716Context –
Took me 25s to open this page.
400ms rtt + %PL = unusable.
Transmission path broken on a level not since csmacd was invented. period. you feel me.
Not even fortnite updates wreak this kind of havoc, sustained ddos, hmmm ok, cable cut yes, poor bgp management could be, how much time do you have ….. 🙂
I mean, how can the (400ms) delay be related to autotrading ?
How do you land the code on the servers ‘over there’, ‘from here’, while building ‘the code’ …… and where and how are the orders routed – FR/UK I guess, maybe, or does ASIC mandate otherwise? FCA and ASIC do have a secret handshake c/o ESMA but I’m a little clueless as to where orders are sent from PRT, again FR, all the IP-exec horsepower is there, no. If so, how’s redundancy catered for?
pending orders would be applied anyway, almost always.
You sure about those pending orders Peter …. no min distance issues or sudden poor execution with resting orders when news drops and you blow past your order – system closed? Can we dodge a bullet that way (resting) and if so, how far out from news dropping do we need to be. TBH Justisan’s pretty much nailed that one and you too.
Your autotrading doesn’t require your PC to be On, am I right ?
I want multiple vps instances in the ‘cloud’ …. I also want a PRT licence, can I have one of those haha
I hear you but last night I had x threads going gaga, 2 x not so silent WS, and it was due to retransmits and all I was doing was trying to ‘build’ an indicator ‘over there’……what a world we live in huh.
None of what I’ve posted is me having a crack at PRT just geography and how it’s well known that optical cable cuts have wreaked havoc in recent times due to mid-east and numb nuts el capitans dragging anchors in the Sunda straights and around SG.
Ya, no dramas with 400ms in general, not being able to access a platform – at all – well, that’s screaming where’s the Stout and Jacks, I’m too old for coke and hookers……maybe.
So yeah, could be auto or manual
04/20/2024 at 7:59 AM #231717Your autotrading doesn’t require your PC to be On, am I right ?
Actually you did not really answer this. If I switch off my PC, Autotrading continues. This the normal situation. However, I know that from Australia access via IBKR’s API can be accomplished (because ProRealTime allows (or allowed) this).
Autotrading runs on the servers over here. No VPS needed for that. Also, with 400ms of latency, no matter where this VPS is, it would not help. Unless … unless that VPS is in Australia somewhere and they have a better connection that you yourself (this is imaginable). But please keep in mind, VPS does not require a VPS at all, while all other trading platforms do (AFAIK).
Does this help ?
If with manual trading the connection is lost (or can be lost) then that’s no deal of course. Pending orders or not.
You sure about those pending orders Peter …. no min distance issues or sudden poor execution with resting orders when news drops and you blow past your order – system closed?
Yes, sure. That is, min distance issues exist anyway, and is not related to your connection from home at all. Whatever means, autotrading ort manual trading, the orders rest on the PRT servers (IB or IG). Thus a pending order from autotrading is refreshed on the server, not by your PC. Notice, however, that some types of orders exist which require your PC to be On (with PRT running on it). AFAIK these orders exist only for (PRT-)IB, and they are not common at all (so much not that I would not know them by heart); (balloon ?) texts shows which they are as a precaution (“Can’t work without PRT active on your PC”).
How do you land the code on the servers ‘over there’, ‘from here’, while building ‘the code’
Your code (as far as I can tell) resides in the editor at first, which in itself will save it to the cloud (to Paris). Thus, this is already so with backtesting (press “backtest” will activate the backtest on the servers in Paris). When given to ProOrder, the same thing happens. When it runs you can shut off your PC.
The fact that a code can be kicked out (everyone’s complaint) is related to nothing, except top the broker (they are the usual cause).Where/how the orders are routed is again not related. But it will be an interface between PRT in Paris and Euronext in Europe somewhere, or Chicago etc. (several in the US). All done by the server in Paris, auto or manual.
and it was due to retransmits and all I was doing was trying to ‘build’ an indicator ‘over there’……what a world we live in huh.
That issue remains. This may indeed possibly be solved by finding a VPS in the proper location. However, generally it will create additional round trip latency. Say A is you, C is PRT and B is the VPS (could be at the closest edge towards Paris in Australia). Then A needs to communicate back and forth to B and B will communicate back and forth with C. And that was only the way to Paris. Back will do the same. This is so severe that most probably your roundtrip latency of 400ms may turn into 2000ms. But it depends on the contentual communication. For example, with copying a file it will be like this (but it may still depend on how the file is copied – think copy vs xcopy from the Dos era – both work totally different and copy will be 10-20 times slower in the A-B-C-B-A situation).
I hope this helps you a bit or byte ?
04/20/2024 at 8:52 AM #231719All understood.
I’ve made the discussion TOO complicated, I should have not made reference to VPS and instances in the cloud. You missed the context and with 25s to load a site (this forum and PRT) you have me at a disadvantage!
I’m not disagreeing with you fwiw, you’re on point but not taking into account … the 25s page load time due to outages X …. 🙂
Stop focusing on the 400ms, it’s the packet loss that’s killing it. RTT is only a symptom of IP que depth and discards.
So we have major packet loss out of AUS.
My problem for the moment is, I can’t access the code editor reliably / at all and it was falling apart last night. So this has been a work in progress for ~18hrs now, it’s not a PRT issues it’s an IP transit issue.
Did I mention the 25s load times….. :|)
I hope this helps you a bit or byte ?
Not one bit, we a little bit, you’re driving me to the hard stuff …. ha.
Once resolved? I can then move on.
—–
So back on topic, is the code linked above do-able or is it as JS said probably not…..
04/21/2024 at 1:27 AM #231754Thanks Peter, yes feedback is all good.
The 25s page loads are sorted – loads rebalanced – and alternate paths working as expected, now need to see how EU business hours are affected.
What this exposed for me was, having one transit path via SG (my ISP) and then by happenstance a sim service also taking the same path (when it never has) via SG (and not out via Sydney and NA like it always has). The companies are completely unrelated other than to provide services on the continent of AUS. Recent cable cuts have exacerbated it and all that relates.
I have a solution in the short term but it really exposes my lack of DR – we had NO access at all. I used to do a bit of this building DCs bitd so in many ways I’ve let myself down tbh but I was lured to going a bit harder down the PRT path a little bit quicker due to deaths in the family and to pass on what little IP I have. So all up really poor planning on my part and I get that you were trying to fish out what I was on about and that I’d made it a little difficult for you in how I was replying and for this I apologise.
Moving on, I will cast an eye across a VPN (alternate path), another SIM (alternate path to ISP and VPN) and perhaps will look at VPS – the key is – having access and for the better part of Fridays sessions EU and NA we had very difficult access to PRT and 25s page load times was an upside at the time. The problem with this is and it can happen, is you end up playing whack a mole in terms of transmission path integrity. To put this into another perspective ‘dedicated IP transit’ from me to the ‘internet’ can roll from AUD500-1000 per month if you want High COS and CIR-like services, this is to just hop off and into the ether let alone dedicate transit elsewhere and tbh 5mbit is fine when there’s zero packet loss but who sells you that. There’s no way I will encourage a family member to ‘housekeep’ an auto-system (look no hands Pa) until some of these outliers are dealt with. I know this sounds like overkill but the auto-trader was meant to ‘peel-out’ X or whatever of what I do and if you kill transit you have zero, we don’t want to remediate when a breakage occurs and then reflect what we could have done differently (that time passed yesterday) we want to establish some kind of resilience in processing as part of there SOP.
So I, like you, spent time explaining to my family member that ‘we live in the caveats of our SOP’ ….. Friday-Saturday was just a taste of it where DR was sadly lacking.
Thanks for taking the time to unravel my posts … 🙂
04/21/2024 at 3:53 AM #231755I know this sounds like overkill but the auto-trader was meant to ‘peel-out’ X or whatever of what I do and if you kill transit you have zero,
What I’m getting at here is in the event you need access because of reasons X, lack of access can be a problem.
You’ve made some very important points Peter one of which is:
Notice, however, that some types of orders exist which require your PC to be On (with PRT running on it). AFAIK these orders exist only for (PRT-)IB, and they are not common at all (so much not that I would not know them by heart); (balloon ?) texts shows which they are as a precaution (“Can’t work without PRT active on your PC”).
04/21/2024 at 4:05 AM #231756Hopefully now being on the right track, I sure know where you’re coming from;
A couple of years ago I was trying to arrange for a redundant connection because of the sheer danger of not being in control, while all the $ may vanish without me knowing. Well, your story under the hood. Over here (Netherlands) such a redundant connection seems impossible because of most odd reasons you can not imagine. One of them – which makes all fail – is that despite you want to pay for the additional ISP (two connections with one ISP is not possible in the first place) – for “good service reasons” the new ISP will cancel your subscription with “the old” ISP. Of course there are checkboxes all over the place asking “do you want us to cancel the old subscription ?” but if you leave that unchecked, they will do it (or it will happen) anyway. That’s just how it works.
And oh, I have 3 phones in use as well, which is also what nothing expects. Formally this is not possible, but with all via WiFi (tethering if necessary) these days, all is possible. Still nothing expects it (WhatsApp may be an exception). In the end we can use that very phone again for general home network internet access (via tethering again), which some do for backup.That said, we hardly have connection issues. Slower loading maybe at times, but that’s because the (then crowded) alternate paths in order to avoid complete shut down.
So … did you try a phone connection ? Of course in the end it will use the same sea lines, but they could be better optimized ? or less crowded because some bandwidth is reserved for “voice” ? of course don’t tell. 🙂
Been thinking about your last post while backtesting the life out of me, but maybe there just is no solution. For me (or us over here ?) it is hard to imagine that things are so poor at your place.
Okay … at finishing this post … why no Sat connection ? in your case the round trip latency wouldn’t even be that more bad. Haha. What is it ? 1500 ms or so ? That should work – or be workable ? Maybe even Musk is able to help these days. LOL.
04/21/2024 at 6:54 AM #231757values of the MACD are recorded in arrays and at the end of a period it is determined which is the highest or lowest values
Can we define the chicken and egg here?
A series of both UP and DN will be defined in the same instance. Can we then lookback and hunt sequence at all?
Not being flippant here it’s a genuine question from a person who was coming to grips with drawing vertical lines not so long ago lol.
Or is this simply a case that as it stands, the outcome of that defined 1 or -1 (and indicator) is to ‘shotgun’ output-print a series of H and L w/o any logic attached or limited somehow.
Just trying get a handle of this JS.
TBH (and thankyou for saying as much) as this is more for someone getting a hang of things (maybe some of us oldies too) it could be perfect for them as is (and not w/in a system). (Like you said).
I did something similar to this and it’s useful in identifying macd flow and prints to a ‘dashboard’ as a heads up, it’s basically Nicolas’s code and it was through this period optical cable cuts landed and I was starting to think the Universe was telling me something! Maybe it is.
I’ll see how and whether it fits. There is such a thing as TMI …. (waves hand, guilty over here) …. 🙂
I wonder then how does the MACD code above (and it’s prospective use) relate to the following:
As a wild stab in the dark here FIB and Vol is where the focus is for Pro-order maybe (or it’s intention), however those levels are ZZ derived I think.
04/21/2024 at 7:19 AM #231758Hopefully now being on the right track, I sure know where you’re coming from;
We have very much the same situation here in AUS where if you place an ‘additional’ service request, you could effectively ‘churn’ from one provider to another.
Some of us have VDSL only services and so the provision for two of these mandates a second physical line, then you have cross-talk implications and our NBN (National Broadand Network) in AUS is keen of no one to have more than one VDSL service and so the DSLAM’s likely to have a fit or could DLM you into a blackhole. Not saying it’s impossible and there’s some who have ventured down that path but it’s not rating very high here because some of us also have GPON access with with 4 fiber-optic ports available per home and here you can go concurrent 4 x service providers but the ONT is limited to 1250mbps on the download side, no biggy really on the speed front BUT our NBN became a political football – it’s INSANE.
Some on VDSL suffer multiple DSL drops daily, while others won NODE-lotto in terms of DSL-node proximity and attainable line rates. The UK bailed on VDSL I believe but our numpties here, when the UK was well into transitioning from VDSL to fiber decided in all there wisdom that we should make the same mistakes. It’s been a mess and seriously disappointing from successive govts.
You’re right on the Sat front, ‘Starlink’ is available in AUS and due to the a sometimes chaotic NBN and how rural and some not so rural areas fair – big country AUS geo-speaking – it’s become a thing.
I’m almost hating you atmo bringing Sat up, I’ve been trying to ignore it.
https://forums.whirlpool.net.au/thread/3vxnrkm3?p=474
The performance of it could surprise you.
Who would have thought L1 in the OSI would become such an involved process.
04/21/2024 at 9:21 AM #23176104/21/2024 at 11:24 AM #231762Hi Inverse,
I also took a look at that other indicator with the Fibionacci…
This indicator uses the “real” ZigZag as a basis, so over a certain period the highest and lowest values are checked afterwards, in other words, the actual signal always comes too late… (at the ZigZag)
In this indicator, they use these highest and lowest points of the ZigZag, but with an imaginative idea, these points are extended to the present and further used as a support (lowest point) and resistance line (highest point). Furthermore, the (ZigZag) points are used as a starting point for the Fibonacci numbers…
So, you could use this indicator in auto-trading, but I don’t see that an actual system has come out…
1 user thanked author for this post.
-
AuthorPosts