appel fonction repeté

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #45228 quote
    Nico
    Participant
    Average

    Bonjour

    J’ai crée un petit systeme auto avec  l’assistant voici le code qui est généré.

    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Conditions to enter long positions
    indicator1 = Average[20](close)
    c1 = (close >= indicator1)
    
    IF c1 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions to exit long positions
    indicator2 = Average[20](close)
    c2 = (close <= indicator2)
    
    IF c2 THEN
    SELL AT MARKET
    ENDIF
    

    La question est pourquoi repete t’il l’appel de la moyenne (indicator2 = Average[20](close)) et n’utilise t’il pas le 1er appel ?

    Je suppose que le code est executé a chaque tick, donc la valeur d’indicator1 est bonne pour tester la sortie.

    Merci

    #45405 quote
    Nicolas
    Keymaster
    Master

    C’est vrai, mais c’est ainsi que fonctionne la création assistée. Dans le cas de ton code ci-dessus, la variable “indicator2” est inutile puisque le programme connaît déjà la valeur de la moyenne mobile 20 périodes contenu dans la variable “indicator1” déclarée à la ligne 4.

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

appel fonction repeté


Support ProOrder

New Reply
Author
author-avatar
Nico @nico Participant
Summary

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

Topic Details
Forum: Support ProOrder
Language: French
Started: 09/02/2017
Status: Active
Attachments: No files
Logo Logo
Loading...