Max position size

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #21526 quote
    Nufstad
    Participant
    Junior

    Hello.

     

    I have an ongoing auto trade on Spot Gold 2 min chart.

     

    When I start the auto trade I am asked the max position size I want. I set it for 2.

    I buy 1 contract in the code. The code buys 1 contract. Sometimes it does not reach the sell condition and it falls back and reaches the buy conditions I set one more time. Now the price may be lower than the buying price on the first contract I bought earlier.

     

    How can I now buy one new contract even though I already have one?

    Gold-StochCross.itf
    #21533 quote
    Nufstad
    Participant
    Junior
    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Conditions to enter long positions
    indicator1 = Stochastic[14,3](close)
    c1 = (indicator1 < 20)
    
    indicator2 = Stochastic[14,3](close)
    indicator3 = Average[5](Stochastic[14,3](close))
    c2 = (indicator2 CROSSES OVER indicator3)
    
    IF c1 AND c2 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // Conditions to exit long positions
    indicator4 = Stochastic[14,3](close)
    c3 = (indicator4 > 80)
    
    indicator5 = Stochastic[14,3](close)
    indicator6 = Average[5](Stochastic[14,3](close))
    c4 = (indicator5 CROSSES UNDER indicator6)
    
    IF c3 AND c4 THEN
    SELL AT MARKET
    ENDIF
    
    // Stops and targets
    SET STOP pLOSS 5
    #21536 quote
    JC_Bywan
    Moderator
    Master

    Hi, I’ll edit your previous message for you, but please:

    For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<

    https://www.prorealcode.com/topic/automatic-trading-support-posting-rules/

    #21539 quote
    Nicolas
    Keymaster
    Master

    If you want to add another position, while you are already on market, just set this line to true:

    DEFPARAM CumulateOrders = true

    Now the system will know you allow it to have more than 1 order on market.

    #21542 quote
    Nufstad
    Participant
    Junior

    Thanks.

     

    It works.

     

    Is it then limitited to the maxs position size I set when I start the auto trade?

    #21546 quote
    Nicolas
    Keymaster
    Master

    The max position size you set when you launch a strategy with ProOrder will ALWAYS be a priority to what you have coded as max positions/orders in your script.

    #87593 quote
    rama
    Participant
    Senior

    DEFPARAM CumulateOrders = False

     

    say maximum position size “2” amount/pt

     

    does it mean maximum points or amount should be open max at any given point time

    if the program conditions are met any it will keep open  a maximum of 2 points or amount

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

Max position size


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Nufstad @nufstad Participant
Summary

This topic contains 6 replies,
has 4 voices, and was last updated by rama
7 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/18/2017
Status: Active
Attachments: 1 files
Logo Logo
Loading...