Not open more trades for today

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #215322 quote
    Tropic
    Participant
    New

    Hello, im trying to code a sytsem on timeframe 30min but i don’t want it to open more than one trade per day,

    so i tried to use a multitimeframe on daily timeframe section by setting something like ” not tradeindex =0″ in the conditions of the orders because it should return the index of the bar of the last trade (therefore it is 0 if he has already opened a trade today) but it doesn’t work.

    How could it be solved? Thanks

    #215326 quote
    robertogozzi
    Moderator
    Master

    Use this variable (OTD) as an additional condition to enter a trade:

    OTD = (Barindex - TradeIndex(1) > IntradayBarIndex)  // IntradayBarIndex < (Barindex - TradeIndex(1)) limits the (opening) trades till  1 per day (OTD One Trade per Day)

    Example:

    Otd              = (Barindex - TradeIndex(1) > IntradayBarIndex)  // IntradayBarIndex < (Barindex - TradeIndex(1)) limits the (opening) trades till  1 per day (OTD One Trade per Day)
    MyLongConditions = Not OnMarket AND close CROSSES OVER Average[10,0](close)
    IF Otd AND MyLongConditions THEN
       BUY 1 Contract at Market
    ENDIF
    SET STOP   pLOSS   100
    SET TARGET pPROFIT 200
    Tropic thanked this post
    #215354 quote
    Tropic
    Participant
    New

    Thanks Roberto it seems to work fine.

     

    Grazie Roberto sei un idolo!

    #215363 quote
    robertogozzi
    Moderator
    Master

    Thanks to the guy who pointed it out and its creator in the library https://www.prorealcode.com/topic/help-with-limiting-strategy-to-one-trade-per-day/#post-143705.

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

Not open more trades for today


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Tropic @tropic Participant
Summary

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

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