help Heikin Ashi long when green short when red

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #23595 quote
    enzo_52
    Participant
    Senior

    hi guys, someone can help me to resolves this problem with heiken Ashi ?
    i want just go long when is green e go short when is red.
    i tried a lot of codes that i took on Prorealcode forum but i have the same problem .
    look at the pic

    Thanks in advance

    
    
    // Definizione dei parametri del codice
    DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
    
    xClose = (open+high+low+close)/4
    IF BarIndex=0 THEN
    xOpen = open
    
    ELSE
    xOpen = (xOpen[1] + xClose[1])/2
    endif
    
    IF XClose >XOpen THEN
    
    BUY 1 CONTRACT AT MARKET
    
    
    else
    
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    TSS.png TSS.png
    #23807 quote
    cfta
    Participant
    Senior

    Ciao Enzo,

    I have a code for this in my Grid Step thread, you can easily change it if you want to remove some parameters such as the grid step function or the DI and ADX filters;

    Grid orders with one combined stop loss and limit, can it be done?

    A system based on Heiken Ashi can be very profitable but we need some sort of filters to avoid trading during sideways movements, the filters in my code helps but we can probably find more useful indicators for that.

    #23968 quote
    enzo_52
    Participant
    Senior

    hi cfta,  thanks for your answer but does not work for me…can you have a look please?

    DEFPARAM CumulateOrders = false
    //Heikin-Ashi
    xClose = (Open+High+Low+Close)/4
    if(barindex>2) then
    xOpen = (xOpen[1] + xClose[1])/2
    endif
    changeToGreencandle = xClose>xOpen AND xClose[1]<xOpen[1]
    ChangeToRedcandle = xClose<xOpen AND xClose[1]>xOpen[1]
    
    if changeToGreencandle then
    
    buy 1 contract at market
    endif
    
    if ChangeToRedcandle then
    
    sellshort 1 contract at market
    endif
    
    tss.png tss.png
    #23977 quote
    enzo_52
    Participant
    Senior

    this is the TS that i tried too..but does not work…

     

    this is the indicator:

    //Heikin-Ashi
    xClose = (Open+High+Low+Close)/4
    if(barindex>2) then
    xOpen = (xOpen[1] + xClose[1])/2
    endif
    changeToGreencandle = xClose>xOpen AND xClose[1]<xOpen[1]
    ChangeToRedcandle = xClose<xOpen AND xClose[1]>xOpen[1]
    Greencandle=xclose>xopen
    redcandle=xclose<xopen
    If changeToGreencandle then
    Indicator1=1
    elsif greencandle then
    indicator1=0.5
    elsif Changetoredcandle then
    indicator1=-1
    elsif redcandle then
    indicator1=-0.5
    Else
    Indicator1=0
    Endif
    
    Return indicator1
    
    
    
    

    this is the TS

     

    // Definizione dei parametri del codice
    DEFPARAM CumulateOrders = false // Posizioni cumulate disattivate
    
    // Condizioni per entrare su posizioni long
    indicator1 = CALL "Heikin ashi"
    c1 = (indicator1[1] = 0.5)
    indicator2 = CALL "Heikin ashi"
    c2 = (indicator2[1] = 1)
    
    IF not onmarket and c1 OR c2 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // Condizioni per entrare su posizioni short
    indicator3 = CALL "Heikin ashi"
    c3 = (indicator3[1] = -1)
    indicator4 = CALL "Heikin ashi"
    c4 = (indicator4[1] = -0.5)
    
    IF not onmarket and c3 OR c4 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    tss-1.png tss-1.png
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

help Heikin Ashi long when green short when red


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
enzo_52 @enzo_52 Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by enzo_52
9 years, 1 month ago.

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