Code help cancel order

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #90789 quote
    Ashevs21
    Participant
    Junior

    Hello,

    i have written a strategy but I am having trouble with the code.

     

    I only want to take a entry after my conditions have been met on the current candle and not carry forward to the next candle.

    So  buy stop at the high of the previous candle high and if it does not enter on the current candle then to cancel the order even if the conditions are still met on the next candle.

    Thank you

    Ashley

    #90792 quote
    robertogozzi
    Moderator
    Master

    Strategies are ALWAYS executed when a bar closes, just microseconds before the next one opens, so your current bars is the bar just closed and can ve referred by [0] or no brackets at all. To place a pending BUY order on the previous HIGH (that is the HIGH of the candle preceding the one just closed) you just have to write:

    BUY 1 CONTRACT AT High[1] STOP   //or LIMIT if current price is higher than high[1]

    Pending orders are always CANCELLED when each bar closes, if not triggered. So you just need not to place them again even if conditions are still met next bar.

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

Code help cancel order


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Ashevs21 @ashevs21 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
7 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/07/2019
Status: Active
Attachments: No files
Logo Logo
Loading...