Vendere a un determinato limite di prezzo

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

    Ciao a tutti,

    non riesco ad usare la funzione limit perchè mi prende sempre il prezzo di apertura.

     
    // Posizioni
    N = 1000
     
    // Donchian
    
    A = 60
    V = 5
    rl1 = 20
    rl2 = 60
     
    DonchianSupA = highest[A](high)
    DonchianInfA = lowest[A](low)
    DonchianSupV = highest[V](high)
    DonchianInfV = lowest[V](low)
    VDC5= DonchianSupV-DonchianInfV
    mDC5= (DonchianSupV-DonchianInfV)/2
    RL20=LinearRegressionSlope[rl1](TotalPrice)
    RL60=LinearRegressionSlope[rl2](TotalPrice)
    
    // Acquista
    
    ca1 = rl20 [1]< rl60[1]
    ca2 = 1.5*VDC5 [1]> VDC5[6]
    CA3 = DonchianSupA [1] > DonchianSupA [61]
    CA4 = DonchianInfA [1] > DonchianInfA [61]
    ca5 = low < DonchianInfV [1]
    
    IF ca1 AND ca2 AND CA3 AND CA4 AND CA5 THEN
    buy n shares at DonchianInfV [1] limit
    ENDIF
    //vendi
    if high >= mdc5[1] then
    sell at mdc5[1] limit
    endif

    Qualcuno sa aiutarmi.

    Grazie

    #123535 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    E’ probabile che il tuo prezzo corrente sia < DonchianInfV [1] , quindi LIMIT entra subito a mercato perché è un prezzo migliorativo. Usa LIMIT quando il prezzo corrente (cioè CLOSE) è SUPERIORE a quello d’entrata e STOP quando è inferiore. L’opposto per gli short.

    Ad ogni modo puoi verificarlo nella finestra delle variabili del backtest che si apre quando usi GRAPH o sul grafico stesso quando usi GRAPHONPRICE. Aggiungi, alla fine del tuo codice, questa riga:

    GraphOnPrice coloured(0,128,0,255) DonchianInfV[1] AS "Prezzo d'Entrata"

    sulle candele vedrai una linea verde che indica il tuo prezzo d’entrata.

    Prima di eseguire la strategia in AutoTrading dovrai togliere, o commentare, le righe che contengono GRAPH e/o GRAPHONPRICE.

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

Vendere a un determinato limite di prezzo


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
elfotrade @elfotrade Participant
Summary

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

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