Contract size calculation issue

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #105424 quote
    BCBC
    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
    robertogozzirobertogozzi
    Moderator
    Legend

    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
    BCBC
    Participant
    Master

    Thanks Robert

    But I found below command was return to nothing.

     

    Test = 0.5 - ( 0.5 MOD 0.5)
    #105496 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    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.
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

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 robertogozzirobertogozzi
7 years, 1 month ago.

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