Contracts to buy

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #73618 quote
    ChrisNYE
    Participant
    Senior
    myATR = 5* averagetruerange[14](close)
    
    SELLSHORT MYATR/250 CONTRACT AT MARKET
    END IF
    
    

    I am trying to create code that will buy/sell contracts based on my atr and risk per trade amount i.e $250 but can’t get it to work

    #73623 quote
    Vonasi
    Moderator
    Master

    What is the ATR of the instrument that you are working on? If it is less than 50 then you will always return a value of less than 1 and PRT will buy 1 contract.

    You ENDIF is also not correctly typed but this will not be the issue.

    #73624 quote
    ChrisNYE
    Participant
    Senior

    Fx can be 0.00147 or an index it could be 10.2

    I thought PRT could now incorporate decimal size contracts?

    #73626 quote
    Vonasi
    Moderator
    Master

    When you say ‘can’t get it to work’ what do you mean exactly. Does it buy nothing or does it buy but only contracts of size 1?

    Have you tried graphing the myATR/25?

    #73627 quote
    Vonasi
    Moderator
    Master

    Sometimes PRT gets confused with division by zero. Try the following:

    MinimumSize = 1 //Minimum size position allowed for instrument
    PositionSize = Max(MinimumSize,(MyATR/250))
    
    SELLSHORT PositionSize contracts at market
    #73629 quote
    ChrisNYE
    Participant
    Senior

    It does something just not what I wanted it to. It should have a max loss @$250 – this doesnt seem to be happening.

    Stupid q I am sure what is this graphing you are talking about?

    The code you gave me only seems to be buying 1 contract

    #73630 quote
    Nicolas
    Keymaster
    Master
    #73638 quote
    ChrisNYE
    Participant
    Senior

    I have absolutely no idea what that is :(. It might as well be written in Mandarin

    #73646 quote
    GraHal
    Participant
    Master

    Have you tried graphing the myATR/25?

    Type

    GRAPH myATR/250′

    at the bottom of your code and run the System and then you will see what the values are of, well errmm yes you’ve guessed it 🙂 …  myATR/250

    #73654 quote
    ChrisNYE
    Participant
    Senior

    Ah ok that seems simple.

    I might time my art by 100 to get number above 1 and then * 5

    #73706 quote
    ChrisNYE
    Participant
    Senior

    I have worked it out – At last I have a win on my side.

    The graph was what I needed – THANK YOU

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

Contracts to buy


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
ChrisNYE @chrisnye Participant
Summary

This topic contains 10 replies,
has 4 voices, and was last updated by ChrisNYE
7 years, 8 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/19/2018
Status: Active
Attachments: No files
Logo Logo
Loading...