Heikin Ashi – changement de couleur de bougie

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #180566 quote
    octdes
    Participant
    Junior

    Bonjour,

    J’aimerais tester une stratégie de trading utilisant les représentations Heikin Ashi.

    La logique est la suivante : achat après une bougie rouge puis une verte. Ensuite vente après une bougie rouge.

    Voici le code :

    capitalinitial=10000
    capital = capitalinitial + STRATEGYPROFIT
    
    HeikinAshiClose = (Open+High+Low+Close)/4
    HeikinAshiOpen = (HeikinAshiOpen[1] + HeikinAshiClose[1])/2
    
    tendance=0
    
    if tendance=0 and (HeikinAshiClose[2]<HeikinAshiOpen[2]) and (HeikinAshiClose[1]>HeikinAshiOpen[1]) then
    tendance=1
    endif
    
    if tendance=1 and (HeikinAshiClose[1]<HeikinAshiOpen[1]) then
    tendance=0
    endif
    
    if tendance and not tendance[1] and not longonmarket then
    positionsize=round(capital/open)
    BUY positionsize SHARES at Market
    endif
    
    if not tendance and tendance[1] and longonmarket then
    SELL positionsize SHARES at Market
    endif
    

    Le Backtest ne fonctionne pas “Pas de données”.

    Avez-vous une idée de comment faire ?

    Merci

    #180577 quote
    Swingueur
    Participant
    Average

    Bonjour,
    Je pense que tendance vaut toujours 0 à chaque barre, et je mettrais “once tendance = 0”
    Ensuite, il y a une initialisation particulière sur les codes Heikin Ashi (voir les codes par ailleurs), car le close s’auto appelle.
    Bien que cela doit rentrer dans l’ordre assez vite, attention aux effets de bords à l’initialisation des variables.

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

Heikin Ashi – changement de couleur de bougie


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
octdes @octdes Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Swingueur
4 years, 4 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 10/29/2021
Status: Active
Attachments: No files
Logo Logo
Loading...