Heikin Ashi candlestick body and moving average condition

Viewing 9 posts - 16 through 24 (of 24 total)
  • Author
    Posts
  • #80991 quote
    Tanou
    Participant
    Senior

    Hello Nicolas,

     

    Before to test this strategy I’d like to understand what “xClose” is standing for..

     

    Can you explain?

     

    Thank you one more time…!

    #80996 quote
    Tanou
    Participant
    Senior

    For information here’s what my code looks like:

    DEFPARAM CumulateOrders = false
    
    // Annule tous les ordres en attente et ferme toutes les positions à 0:00, puis empêche toute création d'ordre avant l'heure "FLATBEFORE".
    DEFPARAM FLATBEFORE = 080000
    // Annule tous les ordres en attente et ferme toutes les positions à l'heure "FLATAFTER"
    DEFPARAM FLATAFTER = 173000
    
    
    //Heikin-Ashi
    xClose = (Open+High+Low+Close)/4
    if(barindex>2) then
    xOpen = (xOpen[1] + xClose[1])/2
    endif
    Green = xClose>xOpen
    
    Period=30 // 48 34
    inner = 2*weightedaverage[ round( Period/2 ) ](xclose)-weightedaverage[Period](xclose)
    MMHULL=weightedaverage[ round( sqrt(Period) ) ]( inner )
    
    macross = xclose crosses over MMHULL
    
    if green[1] and macross and green then
    buy at market
    endif
    
    set target pprofit 7// EN 1 MIN 9 7
    set stop ploss 31 // EN 1 MIN 11 31
    

    What I don’t get is the clos and why it keeps opening position 1 bar “too late”, is there a way to make it one bar before for the entry?

    #81000 quote
    Nicolas
    Keymaster
    Master

    xClose is the variable that hold the HeikinAshi candlestick Close value.

    Positions are not opened too late: code is read at Close, positions are opened at next bar Open.

    #81001 quote
    Tanou
    Participant
    Senior

    Ok so waht is the xOpen standing for? The previous candle opening?

    #81002 quote
    Nicolas
    Keymaster
    Master

    xOpen is the variable for the Heikin Ashi Open value.

    HeikinAshi candlesticks are smoothing the price, that’s why they give different values than the real price and therefore need to be calculated.

    #81010 quote
    Tanou
    Participant
    Senior

    I get it but why calculate xClose and not xOpen then?

    #81011 quote
    Tanou
    Participant
    Senior

    To be precise, the only point I don’t get is this calculation:

    xOpen = (xOpen[1] + xClose[1])/2

    What is it calculating?

    #81012 quote
    Tanou
    Participant
    Senior
    Green = xClose>xOpen
    harange = abs(xclose-xopen)

    “Green” is a condition showing when the current candle is above the previous candle

    “harange” is calculating the abs value of an evolution

    So when you write:

    harange>harange[1]

    It returns “Green” but on previous candles right?

    #81015 quote
    Nicolas
    Keymaster
    Master

    I get it but why calculate xClose and not xOpen then?

    To be calculated xOpen need at least 1 xClose, that’s why we wait 2 barindex before its calculation:

    if(barindex>2) then
     xOpen = (xOpen[1] + xClose[1])/2
    endif

    “Green” is a condition showing when the current candle is above the previous candle

    No. Green is a boolean condition to test if xClose is superior to xOpen (a green Heikin Ashi candle), if it is true, green=1.

    I strongly recommend you to watch the training videos for programming, the first course is free 😉

    harange>harange[1] is testing if the current range is superior to its previous one, like the way you want in your initial request. Number in brackets is an offset in the past.

Viewing 9 posts - 16 through 24 (of 24 total)
  • You must be logged in to reply to this topic.

Heikin Ashi candlestick body and moving average condition


ProOrder support

New Reply
Author
author-avatar
Tanou @tanou Participant
Summary

This topic contains 23 replies,
has 3 voices, and was last updated by Nicolas
7 years, 4 months ago.

Topic Details
Forum: ProOrder support
Language: English
Started: 09/17/2018
Status: Active
Attachments: 2 files
Logo Logo
Loading...