Conversion of Ehlers' "DominantCycle" from TradeStation

Forums ProRealTime English forum ProBuilder support Conversion of Ehlers' "DominantCycle" from TradeStation

  • This topic has 10 replies, 2 voices, and was last updated 1 year ago by avatarΞ3.
Viewing 11 posts - 1 through 11 (of 11 total)
  • #107929
    Ξ3
    Hi Nicolas, Moderators & Advanced Users,
    I am really hoping that someone can come up with a clever way of converting the below John Ehlers indicator found in the September 2016 TASC magazine to PRT code. Despite my best efforts I have not come up with a way to achieve this and believe me I have tried.
    Basically it calculates the dominant cycle period value using the “autocorrelation periodogram” method, which Ehlers recommends. All details I have on this indicator can be found here: http://traders.com/Documentation/FEEDbk_docs/2016/09/TradersTips.html
    I know that PRT does not support arrays but I have overcome this problem by defining multiple variables to “simulate” / “cater for”  an array maximum of 60 (even 48 will do). I have also tried to remove as many loops as possible but haven’t managed to overcome the infinite loop / too many iterations problem. Any ideas or help will be greatly appreciated?
    An extract of the TradeStation code that I am desperate to convert to ProRealTime is below:
    Many thanks and praise to anyone willing to take on this challenge 😉
    ———————————————————————————-

     

    #107930

    >> For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<

    1 user thanked author for this post.
    avatar Ξ3
    #107932
    Ξ3

    Never even saw that button before you pointed it out now, sorry. 🙁

    Will sure to use it in future, thanks! 🙂

    #107942

    Right, without arrays, the solution is to use loop and nested loops.. but we quickly fell in the in infinite loop ambush!

    There was a try about dominant cycle indicator conversion in this thread: https://www.prorealcode.com/topic/calcul-de-la-periode-des-cycles-selon-ehlers/

    Or even in this one: https://www.prorealcode.com/topic/ehlers-sinewave-indicator/

    #107949
    Ξ3

    Bonjour Nicolas,

    I did see the English post on this but I somehow missed the French one (although I do understand a bit of French) and I have now gone through it as well. Both of these posts seem to be making use of the “homodyne discriminator” method. FYI, there is a link to a working copy of this method in another post on ProRealCode which comes from the HK Lisse Blog for those that are interested http://hk-lisse.over-blog.com/tag/les%20cycles/

    The code above however is from Ehlers’ more recent work and his “new preferred” method for calculating the dominant cycle period, which I have been trying to get working in PRT.

    Below is my most recent code attempt to emulate the “new” logic taking into account the ProRealTime restrictions of arrays and loop limitations but I have not progressed past a certain point and need some fresh eyes on solving the problem (you have been very resourceful in the past ;-)) The code runs perfectly in ProRealTime up to the point where it calculates the “Maximum Power Level For Normalization” (I wanted to give you the line number but it doesn’t show when editing this post – roughly line 765 which contains ”   If 1=2 then // 1=2″). Currently my code is halted at this point (to debug it) but the problem is highlighted if you simply comment out or remove all lines that contain the string “1=2”. Any ideas to get the full code to execute in PRT to calculate the correct “AutoPeriodRaw” value?

    Merci beaucoup!

    #107966

    Thanks, could you please repost the code as an attached file (itf or even a text file), because the code is too long for the forum! 🙂

    #108031
    Ξ3

    Sorry about that. I hope I didn’t break anything?

    I attach a text file of my code 😉

    #115249

    Hi, newbie here and in coding.
    I don’t understand how the left hand side of the equation can be solved if the right hand side has the same variable. like the ” cosinepart[period]” is on both sides. They wont be cancelled out?
    I don’t want to blindly copy codes and done.

    CosinePart[Period] = CosinePart[Period] +
    Corr[N]*Cosine(360*N / Period);

    Hope to get a response from the experts

    #115281
    Ξ3

    Hi Avangers,

    The way that coding works allows for this. Effectively you can modify an existing value, using its “current” value state.

    A simpler example of this would be:

    aVariable = 20

    aVariable = aVariable + 1

    After the above two lines of code, aVariable will now be 21

    Hope this helps?

    #179890

    Now that the arrays are available in prorealtime would it be possible for you to rewrite the https://www.prorealcode.com/wp-content/uploads/2019/09/IndCyclePeriodogram.v0.1.txt code with the arrays? Thank you.

    #193463
    Ξ3

    Hi sal157011,

    Apologies for only responding now…

    As I have not been able to code this, I have moved on to other indicators that do not make use of arrays.

    If you or anyone else have been able to code this in ProRealTime, please do post it here for all to benefit from it…

Viewing 11 posts - 1 through 11 (of 11 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login