how do i sell at next candle?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #87466 quote
    jebus89
    Participant
    Master

    How do i code “sell at next candle”, in other words sell at the next candle close no matter what

    #87471 quote
    Vonasi
    Moderator
    Master

    You can never sell at the close. You can only sell at the open after the close!

    If you enter mid candle with a limit or stop order then this will close the trade on the same candle (well the following open at least). Otherwise if your strategy bought at the open then it will sell at the close (or following open really) of the candle after the decision candle – the same one that you entered on.

    if onmarket then
    sell at market
    endif
    #87486 quote
    jebus89
    Participant
    Master

    What about “exit after X bars”, possible to code? 🙂

    #87493 quote
    Vonasi
    Moderator
    Master

    Just start counting bars from the moment you decide you want to exit after x bars or save the barindex and and exit when barindex equals your saved value plus however many bars.

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

how do i sell at next candle?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
jebus89 @jebus89 Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by Vonasi
7 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/19/2018
Status: Active
Attachments: No files
Logo Logo
Loading...