Contract size calculation issue

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #105424 quote
    BC
    Participant
    Master
    PositionSizeLong = MIN(10,MAX(0.5,abs(round((LongMaxRisk/(Close*(MaxSLPrecentageLong/100))/PointValue)*pipsize))))

    Hi PRT Master

     

    Above code give the contract size result as 0.5, 1, 2, 3, 4……10.

    What command should use to make it 0.5, 1, 1.5, 2.0, 2.5……..10?

     

    Thanks.

    #105425 quote
    robertogozzi
    Moderator
    Master

    I have not tested it for lack of missing values, but this is your line as I modified it, plus another line to avoid 0.1, 02, …

    PositionSizeLong = abs((round(((LongMaxRisk/(Close*(MaxSLPrecentageLong/100))*10)/PointValue)/10)*pipsize)
    PositionSizeLong = PositionSizeLong - (PositionSizeLong MOD 0.5)
    #105483 quote
    BC
    Participant
    Master

    Thanks Robert

    But I found below command was return to nothing.

     

    Test = 0.5 - ( 0.5 MOD 0.5)
    #105496 quote
    robertogozzi
    Moderator
    Master

    You are right, the MOD operator only works with integer results.

    Try replacing 100 with 200 in your first line posted.

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

Contract size calculation issue


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
BC @robin_chan Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/24/2019
Status: Active
Attachments: No files
Logo Logo
Loading...