timed closure of a trade

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #19272 quote
    DymjohnDymjohn
    Participant
    Senior

    Hi

    Can anyone help me to make a trading system close all trades at 210000 on a Friday. I can use the defparam command to close at a set time each day but I don’t want a trade left open over the weekend I’m happy for trades to remain open overnight during the week?

    dymjohn

    #19290 quote
    ElsborgtradingElsborgtrading
    Participant
    Veteran

    Hi John.

    Try this

    IF CurrentDayOfWeek = 5 and time >=210000 then
    SELL AT MARKET
    Exitshort At market
    Endif
    

     

    Cheers Kasper

    #19372 quote
    DymjohnDymjohn
    Participant
    Senior

    Hi Casper,

    Thanks Casper, I thought the following might work but opens and closes all trades on Friday for a loss of the spread on test so not right.

    indicator9 = dayofWeek =5
    indicator10 = 210000
    c7 = (indicator9 and indicator10)
    IF c2 and c6 OR c7 THEN
    SELL AT MARKET
    ENDIF
    #19373 quote
    JC_BywanJC_Bywan
    Moderator
    Master

    Hello

    >> For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<

    Be careful with use of combinations of “and” and “or”, you might want to use parenthesis to make sure the logic you really want is applied, for example : c2 and (c6 or c7) is not the same as (c2 and c6) or c7

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

timed closure of a trade


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Dymjohn @dymjohn Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by JC_BywanJC_Bywan
9 years, 8 months ago.

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