Heikin Ashi Advanced – help with simple code

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #227915 quote
    lingierlingier
    Participant
    New

    I love the following indicator, created by Gidien: https://www.prorealcode.com/prorealtime-indicators/heikin-ashi-advanced/

    I’m interested in incorporating this indicator into my trading strategy, but I’m not well-versed in coding.
    As a beginner, I’d appreciate assistance with the following:

    • Buy when the candlestick is green.
    • Sell when the candlestick is red.

    This would already mean a step forward for me.

    I hope someone can assist me with this

    Gr

    #227918 quote
    jacquesgermainjacquesgermain
    Participant
    Veteran

    Good morning

    For example

    purchase:

    F= ao < ac and ao[1]>ac[1]

    if F then

    BUY 10000 CASH at market
    SET STOP %LOSS ts
    SET target %profit tp
    endif

    sale :

    G= ao > ac and ao[1]<ac[1]

    if G then

    SELL 10000 CASH at market
    SET STOP %LOSS ts
    SET target %profit tp
    endif

    #227920 quote
    JSJS
    Participant
    Master

    Hi,

    Here is the system that buys when the color changes to green and sells when the color changes to red…

    // ############# Heikin-Ashi Advanced ##################################################
    // Written by GSL
    
    DefParam CumulateOrders=False
    
    bo = Average[MAX(1,sma1),AverageType1](Open)
    bh = Average[MAX(1,sma1),AverageType1](high)
    bl = Average[MAX(1,sma1),AverageType1](low)
    bc = Average[MAX(1,sma1),AverageType1](close)
    
    
    IF BarIndex <= sma1 + 1 THEN
    haOpen =  bo
    haClose = bc
    haHigh = bh
    haLow  = bl
    //PRINT(haClose)
    ELSe
    haOpen = (haOpen[1] + haClose[1]) / 2
    haClose = (bo + bc + bl  + bh ) / 4
    haHigh = MAX( MAX(bh , haOpen), haClose  )
    haLow  = MIN( MIN(bl  , haOpen), haClose  )
    ao = Average[MAX(1,sma2),AverageType2](haOpen)
    ah = Average[MAX(1,sma2),AverageType2](haHigh)
    al = Average[MAX(1,sma2),AverageType2](haLow)
    ac = Average[MAX(1,sma2),AverageType2](haClose )
    ENDIF
    
    IF ao < ac THEN
    Buy 1 contract at Market
    ELSIF ao > ac THEN
    SellShort 1 contract at Market
    EndIf
    Scherm­afbeelding-2024-02-11-om-14.52.10.jpg Scherm­afbeelding-2024-02-11-om-14.52.10.jpg Heikin-Ashi-Adv.-System.itf
    #227926 quote
    lingierlingier
    Participant
    New
    Thx for the *.itf , JS. In your screenshot, it indeed seem to do the trick, exactly how I would want it.  But in my workstation, it appears different. Also the name of the backtest appears as (0 0 48 26) and not as (0 0 f 7 3) Maybe this is because I’m using it on timeframes of 1 week?  Any tips?
    #227932 quote
    JSJS
    Participant
    Master

    Hi,

    Did you use the “ITF” file because it contains the parameters that you can adjust…

    The time frame shouldn’t matter when using the system, but it does affect the results…

    #227933 quote
    lingierlingier
    Participant
    New
    Got it fixed Thx for the help all !
    JS thanked this post
Viewing 6 posts - 1 through 6 (of 6 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

Heikin Ashi Advanced – help with simple code


General Trading: Market Analysis & Manual Trading

New Reply
Author
author-avatar
lingier @lingier Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by lingierlingier
2 years, 7 months ago.

Topic Details
Forum: General Trading: Market Analysis & Manual Trading
Language: English
Started: 02/11/2024
Status: Active
Attachments: 2 files
ProRealCode ProRealCode
Loading...