Day trade exit code error

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #188555 quote
    AlfredAlfred
    Participant
    Average

    Hi

    I have write the following code in the algo, but the result, it does not close the position at that time.

    if shortonmarket and time = 230000 THEN
    EXITSHORT positionsize CONTRACT AT MARKET
    ENDIF
    
    if longonmarket and time = 240000 THEN
    SELL positionsize CONTRACT AT MARKET
    ENDIF
    

    You can see the Bar…these trade is over many days and close it at trail stop/target profit/stop loss.

    Thanks

    BAR.png BAR.png
    #188557 quote
    PeterStPeterSt
    Participant
    Master

    close it at trail stop/target profit/stop loss.

    Hi Alfred – You are only talking about the first trade in that list, right ? all others look fine to me, although you don’t show the exit code for that.

    Is that instrument from a market which is open at those times ? … I would find it harder to find instruments which are open at those times, if the times would be mapped to European times (Amsterdam specifically). And then this won’t work …

    Alfred thanked this post
    #188560 quote
    AlfredAlfred
    Participant
    Average

    Thanks, the code is work  in the other algo.

    I am trying to find out the reason in this algo, thanks

    #188568 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    240000 does not exit.

    Time ranges from 000000 to 235959.

    Alfred thanked this post
    #188571 quote
    AlfredAlfred
    Participant
    Average

    Thanks! Your are right, and fixed 🙂

Viewing 5 posts - 1 through 5 (of 5 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

Day trade exit code error


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Alfred @kin08180213 Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 02/20/2022
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...