ProBackTest: orders with decimal quantities

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

    I have developed a BackTaster for a BitCoin strategy, however I have been unable to sell/buy fractional volumes (like 0.01 BitCoins). It looks like the volume is always rounded to the nearest unit. How can I fix that? Thanks!

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    ONCE InitialCash = 10000
    
    CurrentCash = InitialCash + STRATEGYPROFIT
    
    Units = ( CurrentCash/10 * 0.5 ) / Close
    
    // Conditions to enter long positions
    indicator1 = CALL "MyIndicators: CriptoFondU"
    c1 = (indicator1 = 1)
    
    IF c1 THEN
    BUY Units CONTRACTS AT MARKET
    ENDIF
    
    // Conditions to enter short positions
    indicator2 = CALL "MyIndicators: CriptoFondU"
    c2 = (indicator2 = -1)
    
    IF c2 THEN
    SELLSHORT Units CONTRACTS AT MARKET
    ENDIF
    #113546 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    The first unit can be 0.5, then it must always be a whole number starting from 1. Then buy 0.5 units / lots / contracts or 1, 2, 30, 1000 … The closure must always be total, partial closure is not yet allowed.

    marco_ghislanzoni thanked this post
    #113547 quote
    marco_ghislanzonimarco_ghislanzoni
    Participant
    New

    Grazie/Thanks Roberto! That makes the BackTester basically unusable for the Forex or Cryptos traded through CFD’s. No good news.

    #113549 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Sorry for speaking italian, I just translated it.

    #113551 quote
    marco_ghislanzonimarco_ghislanzoni
    Participant
    New

    Sorry as well about the Italian title, I thought I was posting this in the Italian forum.

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

ProBackTest: orders with decimal quantities


ProOrder: Automated Strategies & Backtesting

New Reply
Summary

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

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