Ralph Vince’s Optimal F Positioning Sizing

Viewing 9 posts - 16 through 24 (of 24 total)
  • Author
    Posts
  • #47463 quote
    juanj
    Participant
    Master

    @Despair, @Nicolas concerning arrays in PRT.

    I have once thought about the idea of creating a preset number of arrays (up to whatever number)  i.e. array1=0, array2=0, array3=0, etc, etc,

    Then use a loop function with If statements to populate and retrieve them as required.

    #47481 quote
    Despair
    Blocked
    Master

    Well you won’t be able to use index notation and without the possibility to use indices there is no array. It is just a lot of variables.

    For a small array this can be done (see the code of the meander bands) but it is impractical for larger arrays.

    #47482 quote
    juanj
    Participant
    Master

    The If statements in the loop would kind of function as an index as there would be an If statement for each of the preset ‘array’ variables.

    It is obviously going to be one heck of a long piece of code if you have for instance 50+ array variables 🙂

    #47490 quote
    Despair
    Blocked
    Master

    Long and slow.

    #47616 quote
    Nicolas
    Keymaster
    Master

    Long and slow.

    and a long list of IF/THEN statements ..

    #47620 quote
    juanj
    Participant
    Master

    @Nicolas, do you maybe know how far away PRT is from implementing arrays? Months? Years?

    #68386 quote
    Gianluca
    Participant
    Master

    Guys, any news?

    #100689 quote
    gabri
    Participant
    Master

    Hi All,

    I tried this code and it seems to be working (slowly but surely). Please double check it and make sure there are no errors:

    src=close-close[1]
    
    
    i=0
    f=0
    delta=0.1
    
    mem=0
    maxdd=lowest[period](src)
    while i<=1 do
    w=1
    
    for j=1 to period do
    ppp=1
    for r=1 to j do
    ppp=ppp*(1+(i*src[period-j]/maxdd))
    next
    w=w*ppp
    next
    mem=w
    if mem>mem[1] then
    f=i
    endif
    i=i+delta
    wend
    return f,0
    Bard thanked this post
    #220227 quote
    Gianluca
    Participant
    Master
    # Definire le variabili
    Capital = 10000 # Il capitale iniziale
    RiskPerTrade = 0.01 # Il rischio massimo per operazione
    StopLoss = 50 # Lo stop loss in punti
    TakeProfit = 100 # Il take profit in punti
    WinRate = 0.6 # La probabilità di successo
    
    # Calcolare il criterio di Kelly
    KellyFraction = WinRate - (1 - WinRate) / (TakeProfit / StopLoss)
    KellyFraction = max(0, KellyFraction) # Assicurarsi che sia positivo
    
    # Calcolare la dimensione della posizione
    PositionSize = Capital * RiskPerTrade / StopLoss * KellyFraction
    
    # Aprire una posizione long se si verifica una condizione
    if c1 then
      buy PositionSize contract at market
    endif
    
    # Aprire una posizione short se si verifica una altra condizione
    if c2 then
      sellshort PositionSize contract at market
    endif
    
    # Chiudere la posizione con lo stop loss o il take profit
    set stop ploss StopLoss
    set target pprofit TakeProfit
Viewing 9 posts - 16 through 24 (of 24 total)
  • You must be logged in to reply to this topic.

Ralph Vince’s Optimal F Positioning Sizing


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Bard @brad Participant
Summary

This topic contains 23 replies,
has 1 voice, and was last updated by Gianluca
2 years, 5 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/02/2017
Status: Active
Attachments: 3 files
Logo Logo
Loading...