Sell if current price less than open

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #158876 quote
    trevor
    Participant
    Senior

    Hi. Is there a code to sell if the current price, within a day candle, is less than the open.

    Have tried several codes but nothing works.

    Thanks in advance.

    #158877 quote
    robertogozzi
    Moderator
    Master

    Strategies are only executed when a candle closes.

    On a Daily TF any strategy cannot be executed while the daily candle is being formed.

    But you can take advantage of the MTF, Multiple Time Frame, support. You can use the search box to know more about it.

    This example shows how to do what you want:

    Timeframe(Daily,UpdateOnClose)
    OpenD = open
    Timeframe(default)
    If close < OpenD Then
       SELL      AT Market
       EXITSHORT AT Market
    Endif

    the default TF is the one that sets the pace and must be the one on your chart. It must be the lowest TF used and all higher TF’s used must be a multiple of it.

    I suggest that you use a 5-minute or 1-minute TF to launch your strategy, so that your strategy is executed every 5 minutes or every minute to check price while the Daily candle is not yet closed.

    #159308 quote
    trevor
    Participant
    Senior

    Sorry for the delay getting back to you Robertoguzzi.

     

    As I am still learning I will take your reply on board.

    Thank you

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

Sell if current price less than open


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by trevor
5 years, 1 month ago.

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