One order each day?

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #12358 quote
    dajvopdajvop
    Participant
    Master

    Hello!

    I have been trying to limit my system to only 1 order each day but I haven’t figured out how to do it.

    Can someone please help me or point me in the right direction?

     

    Best regards,

    Dvid

    #12361 quote
    grizzlygrizzly
    Participant
    Average

    Clarify this:

    Is it , 1 order & 1 execution ? or, 1 trade (buy and sell order executed) ? or even,

    1 order & 1 non-execution ?

    #12362 quote
    dajvopdajvop
    Participant
    Master

    Sorry.

    I mean 1 entry/day, not necessarily exit the same day, that depends on the market.

    But, if exit the same day, then the system should not try to enter the market again.

    I guess what I am looking for is some sort of counter.

    If no entry today, then buy. If 1 entry today already, then no buy. I just don’t know how to put it into code.

    #12364 quote
    grizzlygrizzly
    Participant
    Average

     

    What time frame are you coding it for ? Ill reply with the code

    #12365 quote
    dajvopdajvop
    Participant
    Master

    Presently I am looking at 15 minutes.

    Thank you! That would be great!

    #12387 quote
    grizzlygrizzly
    Participant
    Average

    Try this as an example :

    DEFPARAM CumulateOrders = False
    
    starttime = 090000
    closetime = 170000
    
    Rule1 = time > starttime and time < closetime and not onmarket[0] 
    Rule1b = (barindex-tradeindex>=(4*15)) //4 x 15mins = 24hours
    Rule2 = close>ExponentialAverage[200](close)
    Rule3 = close<ExponentialAverage[200](close)
    
    if Rule1 and Rule1b and Rule2 then
    buy 2 contract at market
    endif
    
    if Rule1 and Rule1b and Rule3 then
    sellshort 2 contract at market
    endif
    
    set stop ptrailing 100
    
    #12388 quote
    dajvopdajvop
    Participant
    Master

    Thank you very much! That works like a charm! 🙂

    #12459 quote
    dajvopdajvop
    Participant
    Master

    Well, it worked in backtests, but PRT won’t let me start the system in automatic trading: strategy.request.program.parsing.error.

    I don’t know where the fault may be.

    #12511 quote
    dajvopdajvop
    Participant
    Master

    Exchanging TIME for CURRENTTIME worked instead:

    Rule1 = currenttime > 090000 and currenttime < 170000 and not onmarket[0]
    Rule1b = (barindex-tradeindex>=(4*15)) //4 x 15mins = 24hours

    if rule1 and rule1b and … then

    buy 1 contract at market

    endif

    #12512 quote
    chrischris
    Participant
    Junior

    hi

    could you explain what rule 1b does or how it works?  Is it the number of bars since the last trade >= 60?

    thanks

    Chris

    #12517 quote
    dajvopdajvop
    Participant
    Master

    Hi Chris,

    Yes, I believe so.

    #12520 quote
    grizzlygrizzly
    Participant
    Average

    Correction  it should be 4lots x 15mins x 24hours :

     

    Rule1b = (barindex-tradeindex>=(4*24)) //4 x 15mins = 1 hour x 24hours = 1 day 
Viewing 12 posts - 1 through 12 (of 12 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

One order each day?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
dajvop @dajvop Participant
Summary

This topic contains 11 replies,
has 3 voices, and was last updated by grizzlygrizzly
10 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/29/2016
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...