Attivare o Disattivare Variabili

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #190313 quote
    Paolo.B
    Participant
    Average

    Ciao Roberto,   non riesco in una funzione probabilmente semplice per te.
    Vorrei attivare o disattivare facilmente delle variabili o indicatori .
    Mi spiego:
    Questo è un semplice esempio di conteggio sul numero di barre

    If longonmarket and (barindex-tradeindex)>=33 then
    SELL AT MARKET
    ENDIF
    If shortonmarket and (barindex-tradeindex)>=33 then
    BUY AT MARKET
    Endif

    Se io desidero lasciare o togliere il funzionamento di questa variabile,  come posso fare senza eliminarla dal trading system, in questo modo capendo la procedura posso agire su tutte le altre variabili.
    Grazie

    #190314 quote
    robertogozzi
    Moderator
    Master

    Devi usare una variabile (tu hai indicato una costante, il 33), fuori dalle IF:

    Contatore = ((barindex-tradeindex) > 33) AND 1
    If longonmarket and Contatore then
       SELL AT MARKET
    ENDIF
    If shortonmarket and Contatore then
       BUY AT MARKET
    Endif

    quando non vorrai più usarla, senza doverla togliere, basta che scrivi la prima riga così:

    Contatore = ((barindex-tradeindex) > 33) OR 1
    #190315 quote
    Paolo.B
    Participant
    Average

    Grazie gentilissimo.

    Scusami se ti faccio altri 2 esempi così ho chiaro tutto quello che poi voglio fare.

    MMobile = average[77,3](close)
    if OpenTime >= 054500 AND OpenTime <= 181500 then

     

    In questi casi come devo fare?
    Così ho diversi esempi e potrò gestire meglio le varie funzioni.
    Ancora grazie

    #190317 quote
    robertogozzi
    Moderator
    Master

    Non puoi disattivare le variabili, ma solo il loro utilizzo (si, oppure no):

    MMobile    = average[77,3](close)
    Condizione = (close CROSSES OVER MMobile) AND 1           //oppure OR 1 per disattivarla
    if (OpenTime >= 054500 AND OpenTime <= 181500) AND 1 then //oppure OR 1 per disattivarla
    #190319 quote
    Paolo.B
    Participant
    Average

    Perfetto Funziona.

    Però volevo farlo anche con stop e target ma non funziona

    sellshort 1 contract at market
    set target %profit   ( 0.50 ) and 1
    set stop %loss         ( 0.50 ) and 1

     

     

    così dovrebbe essere attivato e con  Or disattivato

    #190321 quote
    robertogozzi
    Moderator
    Master

    Non puoi disattivare un’istruzione, in quel caso devi utilizzare IF…ENDIF:

    sellshort 1 contract at market
    IF 1=1 THEN                      //oppure 1=0 (o 0=1) per disattivarli
       set target %profit ( 0.50 )
       set stop %loss     ( 0.50 )
    ELSE
       set target %profit 0
       set stop %loss     0
    ENDIF
    #190322 quote
    Paolo.B
    Participant
    Average

    Geniale

    Grazie per la tua disponibilità

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Attivare o Disattivare Variabili


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Paolo.B @paolo-b Participant
Summary

This topic contains 6 replies,
has 2 voices, and was last updated by Paolo.B
3 years, 10 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 03/22/2022
Status: Active
Attachments: No files
Logo Logo
Loading...