Different market entries with different positionsize.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #188852 quote
    jhonjhon
    Participant
    New

    I am looking for code for two different inputs within the same system.

    The first entry is under conditions a and b and positionsize normal.
    The second entry is under conditions a, b, and c and positionsize/2.

    They are not cumulative positions, or he enters with the first entry or with the second entry.

     

    Thanks.

    #188853 quote
    JSJS
    Participant
    Master

    Hi @jhon,

    Something like this…

    DefParam CumulateOrders = False
    
    IF NOT OnMarket AND a and b THEN
    BUY PositionSize Contracts AT MARKET
    ENDIF
    
    If Not OnMarket AND a and b and c THEN
    BUY PositionSize/2 Contracts AT MARKET
    ENDIF
    #188859 quote
    PeterStPeterSt
    Participant
    Master

    Something like this

    IF NOT OnMarket AND a and b THEN
    BUY PositionSize Contracts AT MARKET
    ENDIF
     
    If Not OnMarket AND a and b and c THEN
    BUY PositionSize/2 Contracts AT MARKET
    ENDIF

    Nah, not really. That may end up with 1.5x PositionSize because it is ambiguous (but we should try it for real in order to be sure); I mean, this will not end up in two times a position, but both will accumulated in the one bar-call.  DefParam CumulateOrders = false won’t help here.

    IF NOT OnMarket AND a and b THEN
      BUY PositionSize Contracts AT MARKET
    ELSIF Not OnMarket AND a and b and c THEN
      BUY PositionSize/2 Contracts AT MARKET
    ENDIF

    Maybe that will work better. 🙂

    #188860 quote
    JSJS
    Participant
    Master

    Hi @jhon,

    First test the entry with the most conditions, then the entry with the second most…etc.

    Otherwise you will endup with a wrong PositionSize.

    Use CumulateOrders = False to prevent cumulated orders.

     

    DefParam CumulateOrders = False
    
    If a and b and c then
    Buy PositionSize/2 Contracts at Market
    ElsIf a and b then
    Buy PositionSize Contracts at Market
    EndIf
    #188870 quote
    jhonjhon
    Participant
    New

    Thank you very much JS.

    I see that the problem I had was because of the order of the entries, your last post.
    For the rest, I was using that same code.

    It is curious, the order of the factors does alter the product. 🙂

Viewing 5 posts - 1 through 5 (of 5 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

Different market entries with different positionsize.


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
jhon @jhon Participant
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by jhonjhon
4 years, 6 months ago.

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