Coding a selling order

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #171526 quote
    George65
    Participant
    Senior

    Hi all,

    Anyone can help me how to code the sell order (long exit) with the content as follows:

    sell at market if price is 50 points higher than MA200 and the candle is red?

     

    Thanks

    George

    #171527 quote
    robertogozzi
    Moderator
    Master

    There you go:

    Bearish = close < open
    Avg     = average]200,0](close)
    Cond    = Bearish AND (close >= (Avg + 50 * PipSize))
    IF Cond AND LongOnMarket THEN
       SELL AT MARKET
    ENDIF
    #171528 quote
    Roger
    Participant
    Veteran

     

    ma200=average[200](close)
    cond1=close-ma200>50
    cond2=close<open
    if cond1 and cond2 then
    sell at market
    endif
    Nicolas thanked this post
    #171529 quote
    Roger
    Participant
    Veteran

    Roberto solution is better because of the pipsize adjustment 🙂

    #171530 quote
    George65
    Participant
    Senior

    Thank you Roberto!

    #171531 quote
    George65
    Participant
    Senior

    Thank you Roger!

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

Coding a selling order


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
George65 @george65 Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by George65
4 years, 8 months ago.

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