Coding a selling order

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #171526 quote
    George65George65
    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
    robertogozzirobertogozzi
    Moderator
    Legend

    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
    RogerRoger
    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
    RogerRoger
    Participant
    Veteran

    Roberto solution is better because of the pipsize adjustment šŸ™‚

    #171530 quote
    George65George65
    Participant
    Senior

    Thank you Roberto!

    #171531 quote
    George65George65
    Participant
    Senior

    Thank you Roger!

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTimeā„¢ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 George65George65
5 years, 3 months ago.

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