pac di entrata

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

    Buongiorno , sto provando a testare un possibile piano di accumulo ; l’idea sarebbe di entrare con x posizioni quando ad esempio il prezzo scende sotto il 5% o il 10% dai massimi di n periodi . Ho scritto questo:

    /definizione indicatori

    ind1 = CALL “deviazione percentuale”[50, 0.05](high)
    ind2 = CALL “deviazione percentuale”[50, 0.1](high)

    //condizioni
    size = 1000/close
    c1 = close crosses under ind1
    c2 = close crosses under ind2

    //entrata
    if c1 then
    buy size shares at market
    endif
    if c2 then
    buy 2*size shares at market
    endif

    L’unico problema è quando il prezzo oscilla a intorno all’indicatore e così mi apre diverse posizioni nell’arco di pochi giorni con poca variazione di prezzo , invece io vorrei che una volta aperta una posizione non ne aprisse un’altra fino al raggiungimento di un nuovo massimo oppure di un certo swing sui massimi. Come potrei fare? Grazie

    #198611 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Eccolo:

    //definizione indicatori
    
    IF Not OnMarket OR (high = highest[50](high)) THEN
       Flag1 = 1
       Flag2 = 1
    ENDIF
    
    ind1 = CALL “deviazione percentuale”[50, 0.05](high)
    ind2 = CALL “deviazione percentuale”[50, 0.1](high)
    
    //condizioni
    size = 1000/close
    c1 = close crosses under ind1
    c2 = close crosses under ind2
    
    //entrata
    if c1 AND Flag1 then
       buy size shares at market
       Flag1 = 0
    endif
    if c2 AND Flag2 then
       buy 2*size shares at market
       Flag2 = 0
    endif

    io ho messo la condizione (high = highest[50](high)) (alla riga 3), ma tu puoi cambiarla come vuoi per fare ripartire l’operatività.

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

pac di entrata


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
contecf @contecf Participant
Summary

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

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