How to operate just once in a day?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #6676 quote
    Picchio65
    Participant
    New

    Hi,

    In my trading system I would like to operate in FOREX market just once in a single day. For example if certain conditions are met the system enters. Imagine that after a certain number of hours the system exit from the market either because of exit conditions or because of stop loss or trailing stop. I would like the system avoids entering again in the market within the same day and instead waits for the next day to enter again.

    A possible way to implement this test is setting a variable at 0 at beginning of the day. If the system enters (long/short conditions met) the variable is set to 1. This prevents the system to enter again in the same day since I add the condition variable=0 in the long/short conditions. But I do not know how to reset the variable at the beginning of each day-trading operating hours.

    Thanks

    #6679 quote
    Nicolas
    Keymaster
    Legend

    You can reset easily your variable each day by testing the intraday bar index with the instruction : intradaybarindex

    Reset your variable by doing this:

    if intradaybarindex = 0 then 
      tradedtoday = 0
    endif
    
    

    And set your variable “tradedtoday” to 1 when you launch a trade. Test it before initiate a new trade. That’s all 🙂

    You could have tested also if the daily open candle was the same as the one saved before in a variable, that’s what I do in other platform programming.

Viewing 2 posts - 1 through 2 (of 2 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 to operate just once in a day?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Picchio65 @picchio65 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
10 years, 4 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/10/2016
Status: Active
Attachments: No files
Logo Logo
Loading...