Pull back strategy

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #123162 quote
    claurent
    Participant
    Junior

    Hello,

    I would like to build a code which will buy when the price made a pull back of 50% of the current wave.

    I would like to set up manually the top and the bottom of the wave when i launch the strategy but if the price continue rising i would need the code to update the new highest and calculate the new level of 50%.

    I tried this code which is not working properly:

     

    defparam preloadbars=10000
    
    bottom = 19844
    originaltop = 19966
    
    hh = highest[barindex](high)
    
    IF hh > originaltop THEN
    top = hh
    ENDIF
    
    IF hh < originaltop THEN
    top = originaltop
    ENDIF
    
    fib50 = ((top - bottom) / 2) + bottom
    c1 = low[0] <= fib50
    IF c1 AND not onmarket THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF

    I tried to backtest it with the graphonprice function but the barindex doesn’t take in consideration the exact period of time i want to test and rather takes all the previous data which bring back a wrong value.

    GRAPHONPRICE fib50

    I would be very gratefull if someone could help me on this matter.

     

    Thanks a lot

     

    Christophe

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

Pull back strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
claurent @claurent Participant
Summary

This topic contains 1 voice and has 0 replies.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/24/2020
Status: Active
Attachments: No files
Logo Logo
Loading...