Limit number of order to 2 per day

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #238421 quote
    VarmaRudra
    Participant
    New

    I have developed a trading strategy and backtested the same using ProRealtrade. I used OTD = Barindex - TradeIndex(1) > IntradayBarIndex to limit the order to one per day. Now i want to see how the results are if i increase number of trades per day to two.

    I searched in the forum below and found below code should be used to limit orders per day to two. However, i am struggling to understand how this code works and it’s not currently delivering my need.

    ( (not onmarket and onmarket[1] and not onmarket[2]) or (tradeindex(1)=tradeindex(2) and tradeindex(1)=barindex[1] and tradeindex(1)>0) )

    Please can i get some help in limiting number of order per day to 2 and this can be configurable..

    #238426 quote
    robertogozzi
    Moderator
    Master

    There you go:

    ONCE MaxTrades = 2
    ONCE Tally     = 0
    //
    // reset the TALLY each new day
    //
    IF IntraDayBarIndex = 0 THEN
       Tally = 0
    ENDIF
    //
    // enter a trade when conditions are met AND the trade to be opened doesn't exceed MaxTrades
    IF MyLongConditions AND (Tally < MaxTrades) THEN
       BUY 1 CONTRACT AT MARKET
       Tally = Tally + 1
    ELSIF MyShortConditions AND (Tally < MaxTrades) THEN
       SELLSHORT 1 CONTRACT AT MARKET
       Tally = Tally + 1
    ENDIF
    SET STOP   pLOSS   100
    SET TARGET pPROFIT 200
    VarmaRudra and Iván González thanked this post
    #238434 quote
    VarmaRudra
    Participant
    New

    Thats brilliant. Thank you.

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

Limit number of order to 2 per day


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
VarmaRudra @varmarudra Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by VarmaRudra
1 year, 4 months ago.

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