how do i sell at next candle?

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

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

    #87471 quote
    VonasiVonasi
    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
    jebus89jebus89
    Participant
    Master

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

    #87493 quote
    VonasiVonasi
    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.
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

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 VonasiVonasi
7 years, 10 months ago.

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