Wait until MA crossed

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #176329 quote
    umebon
    Participant
    Average

    Hi

    Need help coding… If my system have closed a position and I want the system to wait until MA(x) is crossed until it take a new position. How do I code that?

    #176332 quote
    robertogozzi
    Moderator
    Master

    Add

    AND close CROSSES OVER MA(x)

    to your conditions to enter a trade.

    umebon thanked this post
    #176334 quote
    Swingueur
    Participant
    Average

    Hello,
    Here is a proposal so that it doesn’t rebuy if the MA was not crossed earlier.

    once aim = 0
    
    // your conditions
    
    IF close crosses over Average[X] THEN
    aim = 1
    ENDIF
    
    IF Not LongOnMarket and aim = 1 and conditions THEN
    // Buy instruction
    aim = 0
    ENDIF
    umebon thanked this post
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Wait until MA crossed


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
umebon @umebon Participant
Summary

This topic contains 2 replies,
has 3 voices, and was last updated by Swingueur
4 years, 6 months ago.

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