Buy if Not OnMarket, Reset every day

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #213674 quote
    ZeroCafeine
    Participant
    Senior

    Hi

    I want to buy if I am not in the market today, But I do not take into consideration positions from the day before :

    IF LongCondition AND Not OnMarket Then
    Buy 1 Shares
    ENDIF

    with “Not OnMarket” I do not consider yesterday’s positions but only today’s ?

    #213675 quote
    phoentzs
    Participant
    Master

    All positions… just not on market…

    #213676 quote
    ZeroCafeine
    Participant
    Senior

    Today I can buy if I’m not on market today, but I don’t considering the position of yesterday

    Day 1 : buy one share if I’m not on market

    Day : even I I’m in position from yesterday, I not considering this, I can buy today but I can’t cumulate order today

    #213678 quote
    ZeroCafeine
    Participant
    Senior

    Hoooo, now because of trying to make a good question I think I found the solution, maybe I just have to count the share of last day, and considering this number like zero for today, I will try to program this after, if you have other solution?

    #213687 quote
    robertogozzi
    Moderator
    Master

    Simply check, when IntradayBarIndex = 0 (i.e. a new day just started), if you are onmarket. If you are then set a FLAG to 1, and use that FLAG as an additional condition to open a new position (to accumulate if it’s the same direction, or Stop & Reverse if it’s not). If you enter a new position clear FLAG, i.e. set it to zero.

    ZeroCafeine thanked this post
    #213715 quote
    ZeroCafeine
    Participant
    Senior

    @robertogozzi tks for the Flag tips,

    Do you have a link from the forum with a very complex flag method, it will perhaps allow me to appropriate the method

    Do you use a specific software for the analysis ?

    I realize now that my programming problem with ProRealTime is due to the analysis of what I want to do, I am very good in analysis, but how to put an analysis on paper, I had learned the method of patatoide I think long time ago (potatoide, I don’t know how to say it in english)

    #213729 quote
    robertogozzi
    Moderator
    Master

    There you go:

    DEFPARAM CumulateOrders = True
    ONCE Flag = 1
    IF IntraDayBarIndex = 0 THEN
       Flag = 1
    ENDIF
    IF MyLongConditions AND (Not OnMarket OR (OnMarket AND Flag = 1)) THEN
       BUY 1 Contract at Market
       Flag = 0
    ENDIF

    you must allow accumulation of positions, of course.

    ZeroCafeine thanked this post
    #213755 quote
    ZeroCafeine
    Participant
    Senior

    tks you for the solution, I found a solution just before your answer, and I thank you very much for the effort you make to formulate such precise answers,

    for quality answers, you are very strong or I am very weak, in any case you are stronger,

    I tested your solution, it makes me buy 2 times in A and 2 times in B, my solution suits me and makes me buy once in C and D, I wil try to understand and use also your solution

    Capture-decran-2023-04-25-a-22.50.41.png Capture-decran-2023-04-25-a-22.50.41.png
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

Buy if Not OnMarket, Reset every day


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 7 replies,
has 3 voices, and was last updated by ZeroCafeine
2 years, 10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/24/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...