ProRealCode - Trading & Coding with ProRealTime™
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/
defparam drawonlastbaronly=true
i = MACD[12,26,9](close)
if i crosses over 0 then
hhbar=barindex
j=j+1
elsif i crosses under 0 then
llbar=barindex
j=j+1
endif
if i > 0 then
hhperiod=max(1,barindex-hhbar)
$hhbar[j]=barindex[highestBars[hhperiod]]
$hh[j]=highest[hhperiod](high)
$dir[j]=1
endif
if i < 0 then
llperiod=max(1,barindex-llbar)
$llbar[j]=barindex[lowestBars[llperiod]]
$ll[j]=lowest[llperiod](low)
$dir[j]=-1
endif
if islastbarupdate then
for x=0 to j do
if $dir[x] = 1 then
drawtext($hh[x],$hhbar[x],$hh[x],dialog,bold, 12)
drawarrowdown($hhbar[x],$hh[x]) coloured("red")
endif
if $dir[x] = -1 then
drawtext($ll[x],$llbar[x],$ll[x],dialog,bold, 12)
drawarrowup($llbar[x],$ll[x]) coloured("green")
endif
next
endif
return
<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
Hi 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…
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.
Your 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 ?
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…..
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,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”).
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
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:
https://www.prorealcode.com/prorealtime-indicators/zigzag-volume-by-price-fibonacci-indicator-fizivol/
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.
Hopefully 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.
Hi 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…
ZZ-MACD Lookback (or others) in Auto-Systems
This topic contains 13 replies,
has 3 voices, and was last updated by JS
1 year, 10 months ago.
| Forum: | ProOrder: Automated Strategies & Backtesting |
| Language: | English |
| Started: | 04/19/2024 |
| Status: | Active |
| Attachments: | No files |
The information collected on this form is stored in a computer file by ProRealCode to create and access your ProRealCode profile. This data is kept in a secure database for the duration of the member's membership. They will be kept as long as you use our services and will be automatically deleted after 3 years of inactivity. Your personal data is used to create your private profile on ProRealCode. This data is maintained by SAS ProRealCode, 407 rue Freycinet, 59151 Arleux, France. If you subscribe to our newsletters, your email address is provided to our service provider "MailChimp" located in the United States, with whom we have signed a confidentiality agreement. This company is also compliant with the EU/Swiss Privacy Shield, and the GDPR. For any request for correction or deletion concerning your data, you can directly contact the ProRealCode team by email at privacy@prorealcode.com If you would like to lodge a complaint regarding the use of your personal data, you can contact your data protection supervisory authority.