Arrotondare contratti PositionSizing

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #197936 quote
    MauroProMauroPro
    Participant
    Veteran

    Ciao Roberto, ho ripreso un tuo codice di money management sul position sizing. Quando si arrotondano i contratti il codice passa da 1 a 1,1, da 1,1 a  1,2 …

    Riesci a modificare ROUND per passare da 1 contratto a 2 ( da 2 a 3 …) non appena il valore è superiore a 1? Grazie

    once positionSizeActivation = 1
    once DD = 500 //500 DrawDown
    once DDmultiplier = 3 //3.0 DD multiplier
    once myMargin = 0.5 //0.5% margin required by the broker
    once myCapital = (DD * DDmultiplier) + (high * MyMargin / 100)
    if intraDayBarIndex = 0 then
    myCapital = (DD * DDmultiplier) + (high * MyMargin / 100)
    endif
    once minPositionSize = 1
    once startPositionSize = 1
    once positionSize = startPositionSize
    if positionSizeActivation then
    myEquity = myCapital + strategyProfit
    myInvestment = myEquity / myCapital
    tempLot = startPositionSize * myInvestment
    tempLot = round((tempLot * 10) – 0.5) / 10
    positionSize = max(minPositionSize,tempLot)
    endif

    #197948 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Sostituisci tempLot = round((tempLot * 10) – 0.5) / 10, con tempLot = ceil(tempLot,0).

    MauroPro thanked this post
    #197950 quote
    MauroProMauroPro
    Participant
    Veteran

    Grazie Robero, ho provato e funziona. Potresti inserire lo stesso arrotondamento da 1 a 2 anche in questa formula semplificata di Vonasi (che presenta altrimenti lo stesso incremento da 1 a 1.1 …)?

    MoneyManagement = 1
    Capital = 10000
    MinBetSize = 1
    Equity = Capital + StrategyProfit
    //Increasing and decreasing position size
    IF MoneyManagement = 1 THEN
    PositionSize = Max(MinBetSize, Equity * (MinBetSize/Capital))
    PositionSize = Round(PositionSize*100)
    PositionSize = PositionSize/100
    ENDIF

    #197964 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    La penultima riga scrivila così:

    PositionSize = ceil(PositionSize/100,0)
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

Arrotondare contratti PositionSizing


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
MauroPro @mauropro Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by robertogozzirobertogozzi
4 years, 1 month ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 07/26/2022
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...