Comprar con todo el Cash

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #205228 quote
    ssa300871
    Participant
    New

    Buenos días:

    Estoy trabajando con un backtest y no se como hacer que tras ganancias o perdidas, hacer que la siguiente compra lo haga con todo el cash que tengo.

    Esto es: si yo tengo 1000€ y gano 150€, como puedo programar para entrar con los 1150€.

    Gracias de antemano y saludos.

    #205234 quote
    robertogozzi
    Moderator
    Legend

    Ahi esta.
    Solo debes indicar el capital inicial (Capitalinicial) y el número de contratos (LotesIniciales) que deseas comprar o vender con ese capital, luego de lo cual se mantiene esa relación en base a utilidades, NUNCA bajando del valor inicial:

    ONCE Capitalinicial = 1000
    ONCE LotesIniciales = 1
    Patrimonio          = Capitalinicial + StrategyProfit
    NumeroContratos     = max(LotesIniciales,floor((Patrimonio / Capitalinicial),1))
    if close crosses over average[100,0](close) and not LongOnMarket then
       buy NumeroContratos Contracts at Market
    elsif close crosses under average[100,0](close) and not ShortOnMarket then
       sellshort NumeroContratos Contracts at Market
    endif
    set stop   ploss   200
    set target pprofit 600
Viewing 2 posts - 1 through 2 (of 2 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

Comprar con todo el Cash


ProScreener: Buscadores de Mercado y Rastreo

New Reply
Author
author-avatar
ssa300871 @ssa300871 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzi
3 years, 9 months ago.

Topic Details
Forum: ProScreener: Buscadores de Mercado y Rastreo
Language: Spanish
Started: 12/03/2022
Status: Active
Attachments: No files
Logo Logo
Loading...