HA-smoothed. Indicator -> Strategy

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #36622 quote
    T-raderT-rader
    Participant
    Average

    Hey guys!

    I´ve been hanging around in the shadows for a while tryin to learn from your coding knowledge.

    I found this Indicator that i would love to make into an automatic trading system, seems like ot got it all.

    HPT Heikin Ashi Smoothed

     

    From what i understand I need to remove the return and color parts and add the buy and sell code.

    Something like the inserted code but I have come to an end of my coding knowledge. Can someone help me?

     

     

    
    //---settings
    MaPeriod=6
    MaPeriod2=2
    //---end of settings
    
    once maOpen=Open
    once maClose=Close
    once maLow=Low
    once maHigh=High
    
    if barindex>0 then
    maOpen=(maOpen[1]*(MAperiod-1)+Open)/MAPeriod
    maClose=(maClose[1]*(MAperiod-1)+Close)/MAPeriod
    maLow=(maLow[1]*(MAperiod-1)+Low)/MAPeriod
    maHigh=(maHigh[1]*(MAperiod-1)+High)/MAPeriod
    
    haOpen=(ExtMapBuffer5[1]+ExtMapBuffer6[1])/2
    haClose=(maOpen+maHigh+maLow+maClose)/4
    haHigh=Max(maHigh, Max(haOpen, haClose))
    haLow=Min(maLow, Min(haOpen, haClose))
    if (haOpen<haClose) then
    r=0
    g=191
    b=255
    ExtMapBuffer7=haLow
    ExtMapBuffer8=haHigh
    else
    r=255
    g=10
    b=0
    ExtMapBuffer7=haHigh
    ExtMapBuffer8=haLow
    endif
    ExtMapBuffer5=haOpen
    ExtMapBuffer6=haClose
    
    ExtMapBuffer1=weightedaverage[MAperiod2](ExtMapBuffer7)
    ExtMapBuffer2=weightedaverage[MAperiod2](ExtMapBuffer8)
    ExtMapBuffer3=weightedaverage[MAperiod2](ExtMapBuffer5)
    ExtMapBuffer4=weightedaverage[MAperiod2](ExtMapBuffer6)
    endif
    
    if ExtMapBuffer7[1]<ExtMapBuffer8[1] and ExtMapBuffer7[2]>ExtMapBuffer8[2] and ExtMapBuffer7[0]<ExtMapBuffer8[0] then
    buy 1 contract at market
    endif
    
    if ExtMapBuffer7[1]>ExtMapBuffer8[1] and ExtMapBuffer7[2]<ExtMapBuffer8[2] and ExtMapBuffer7[0]>ExtMapBuffer8[0] then
    sell at market.
    endif
    
    #36626 quote
    GraHalGraHal
    Participant
    Master

    I got it to spring into life so you can work it some more?

     

    //---settings
    MaPeriod=6
    //MaPeriod2=2
    //---end of settings
     
    once maOpen=Open
    once maClose=Close
    once maLow=Low
    once maHigh=High
     
    if barindex>0 then
    maOpen=(maOpen[1]*(MAperiod-1)+Open)/MAPeriod
    maClose=(maClose[1]*(MAperiod-1)+Close)/MAPeriod
    maLow=(maLow[1]*(MAperiod-1)+Low)/MAPeriod
    maHigh=(maHigh[1]*(MAperiod-1)+High)/MAPeriod
     
    haOpen=(ExtMapBuffer5[1]+ExtMapBuffer6[1])/2
    haClose=(maOpen+maHigh+maLow+maClose)/4
    haHigh=Max(maHigh, Max(haOpen, haClose))
    haLow=Min(maLow, Min(haOpen, haClose))
    if (haOpen<haClose) then
    
    ExtMapBuffer7=haLow
    ExtMapBuffer8=haHigh
    else
    
    ExtMapBuffer7=haHigh
    ExtMapBuffer8=haLow
    endif
    ExtMapBuffer5=haOpen
    ExtMapBuffer6=haClose
     
    
    short = ExtMapBuffer7[1]>ExtMapBuffer8[1] and ExtMapBuffer7[2]<ExtMapBuffer8[2] and ExtMapBuffer7[0]>ExtMapBuffer8[0]
    long = ExtMapBuffer7[1]<ExtMapBuffer8[1] and ExtMapBuffer7[2]>ExtMapBuffer8[2] and ExtMapBuffer7[0]<ExtMapBuffer8[0]
    endif
    
    If long Then
    Buy 1 contract at market
    Endif
     
    if short then
    sell at market
    endif
    
    //if short then
    //sellshort 1 contract at market
    //endif
    //
    //if long then
    //exitshort at market
    //endif
    
    T-rader.jpg T-rader.jpg
    #36637 quote
    T-raderT-rader
    Participant
    Average

    Nice GraHal! Thanks. I´ll come back if I get it to work decent

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

HA-smoothed. Indicator -> Strategy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
T-rader @t-rader Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by T-raderT-rader
9 years, 4 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/25/2017
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...