Limit number of order to 2 per day

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #238421 quote
    VarmaRudraVarmaRudra
    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
    robertogozzirobertogozzi
    Moderator
    Legend

    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
    VarmaRudraVarmaRudra
    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.
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

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 VarmaRudraVarmaRudra
1 year, 11 months ago.

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