Prevent closing of the position at certain times.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #173479 quote
    Paolo.B
    Participant
    Average

    Kindly I need some help.
    I would like to prevent a position from closing at certain times.
    For example do not close a position from 01 to 06 in the morning.
    Thank you

    #173481 quote
    robertogozzi
    Moderator
    Master

    Well… if you have set some TP, the trade will be closed when it’s hit and you can’t help it.

    If you have conditions to exit a trade, then you can prevent it from being closed:

    // LONG entry
    If close crosses over average[20] and not OnMarket then
       Buy at market
    Endif
    // LONG exit
    If close crosses under average[20] and LongOnMarket and time >= 070000 and time < 220000 then
       Sell at market
    Endif
    Paolo.B thanked this post
    #173482 quote
    GraHal
    Participant
    Master

    So you can’t use TP conditions as below Roberto?

    If Time > 070000 and Time < 210000 Then
    Set target %profit 1
    Endif
    #173483 quote
    robertogozzi
    Moderator
    Master

    Yes, indeed it’s possible, 0 should disable it.

    GraHal thanked this post
    #173512 quote
    Paolo.B
    Participant
    Average

    Thanks, it works well unfortunately the performance deteriorates.

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

Prevent closing of the position at certain times.


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Paolo.B @paolo-b Participant
Summary

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

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