SISTEMA DELLE TRE CANDELE CONSECUTIVE

Viewing 12 posts - 31 through 42 (of 42 total)
  • Author
    Posts
  • #105524 quote
    AlessandroAlessandro
    Participant
    Junior
    ONCE CandleNum = 3
    Bullish        = summation[CandleNum](close > open) = CandleNum
    Bearish        = summation[CandleNum](close < open) = CandleNum
    HigherHIGHs    = (summation[CandleNum - 1](high > high[1]) = (CandleNum - 1))
    LowerLOWs      = (summation[CandleNum - 1](low < low[1])   = (CandleNum - 1))
    MyRsi          = Rsi[14](close)
    IF Bearish AND LowerLOWs AND Not OnMarket AND MyRsi > 30 THEN
    BUY 1 CONTRACT AT MARKET
    Sl = max(S,(close - low) / pipsize)
    Tp = Sl * M
    ENDIF
    IF Bullish AND HigherHIGHs AND Not OnMarket AND MyRsi < 70 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    Sl = max(S,(high - close) / pipsize)
    Tp = Sl * M

    la stringa che manda l acquisto bearish dice se bearish e lowerlow ec ecc buy 1 contract at market….ma è sbagliata? se è in fase bearish dovrebbe andare in sellshort o sbaglio

    quindi anche bullish è sbagliata perchè invece di buy dà il comando sellshort

    #105525 quote
    AlessandroAlessandro
    Participant
    Junior

    Come potrei scrivere una variabile che dice “se la candela rialzista tra apertura e chiusura raggiunge  una somma maggiore  di N pips buy 1 contract at market

    e la versione short

    #105527 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Dipende, puoi usarla come conferma del trend, facendo come dici tu, oppure come inversione del trend com’è adesso.

    Per l’altro post:

    If close - open > 15 * pipsize then
       Buy 1 contract at market
    Endif
    #105573 quote
    AlessandroAlessandro
    Participant
    Junior

    Dipende, puoi usarla come conferma del trend, facendo come dici tu, oppure come inversione del trend com’è adesso.

    Per l’altro post:


    Scusa roberto e l’inverso di questo script cioè con candela ribassista come sarebbe?

    ho provato a scriverlo io ma sbaglio qualcosa

    grazie

    #105574 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Alla riga 2 inverti Open e Close.

    Ovviamente dovrai usare Sellshort invece di Buy.

    Alessandro thanked this post
    #107794 quote
    GaspareGaspare
    Participant
    Veteran

    Buongiorno, ciao Roberto

    in merito alle 3 candele consecutive rosse o verdi, si prende posizione long dopo 3 rosse con minimi decrescenti e short dopo 3 verdi con massimi crescenti.

    Attivando il sistema solo sul TF di 5 minuti, vorrei entrare in posizione se nel TF di 60 minuti la candela sia di diverso colore, cioè:

    candela rossa a 60:     nel 5 si va short dopo 3 candele verdi, e non long dopo 3 rosse, dato che il trend di breve sembra al ribasso

    candela verde a 60:    nel 5 si va long dopo 3 candele rosse, e non short dopo 3 verdi, dato che il trend di breve sembra al rialzo.

    Vorrei entrare in posizione nel 5 dopo un ritracciamento, seguendo il trend del 60.

    Grazie

    #107866 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Ecco:

    DEFPARAM CumulateOrders = false
    //
    TIMEFRAME(5 minute,updateonclose)
    Rossa5 = close < open
    Verde5 = close > open
    //
    TIMEFRAME(1 hour,updateonclose)
    RossaH = close < open
    VerdeH = close > open
    //
    TIMEFRAME(default)
    ONCE Barre = 3
    VaiLONG  = VerdeH AND (summation[Barre](Rossa5 AND low  < low[1])  = Barre)
    VaiSHORT = RossaH AND (summation[Barre](Verde5 AND high > high[1]) = Barre)
    IF Not OnMarket THEN
       IF VaiLONG  THEN
          BUY 1 CONTRACT AT MARKET
       ENDIF
       IF VaiSHORT THEN
          SELLSHORT 1 CONTRACT AT MARKET
       ENDIF
       SET TARGET pPROFIT 60
       SET STOP   pLOSS   40
    ENDIF
    #120249 quote
    GaspareGaspare
    Participant
    Veteran

    Ciao Roberto

    per favore puoi fare un controllo di sintassi del seguente codice?

    Grazie

    DEFPARAM CumulateOrders = false
    //
    TIMEFRAME(3 minute,updateonclose)
    Rossa3 = close < open
    Verde3 = close > open
    //
    TIMEFRAME(60 minute,updateonclose)
    Rossa60 = close < open
    Verde60 = close > open
    Trend           = supertrend[A,B]
    prezzo=close[0]
    C1=prezzo>Trend
    C2=prezzo<Trend
    TIMEFRAME(default)
    ONCE Barre = X
    VaiLONG  = Verde60 AND C1  AND (summation[Barre](Rossa3 AND low  < low[1])  = Barre)
    VaiSHORT = Rossa60 AND C2  AND (summation[Barre](Verde3 AND high > high[1]) = Barre)
    IF Not OnMarket THEN
    IF VaiLONG  THEN
    BUY 1 CONTRACT AT MARKET
    Sl = max(S,(close - low) / pipsize)
    Tp = Sl * M
    ENDIF
    IF VaiSHORT THEN
    SELLSHORT 1 CONTRACT AT MARKET
    Sl = max(S,(high - close) / pipsize)
    Tp = Sl * M
    ENDIF
    SET STOP   pLOSS   Sl
    SET TARGET pPROFIT Tp
    ENDIF
    trailingstop = T
    //resetting variables when no trades are on market
    if not onmarket then
    MAXPRICE = 0
    MINPRICE = close
    priceexit = 0
    endif
    //case SHORT order
    if shortonmarket then
    MINPRICE = MIN(MINPRICE,close) //saving the MFE of the current trade
    if tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
    priceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price level
    endif
    endif
    //case LONG order
    if longonmarket then
    MAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current trade
    if MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then
    priceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price level
    endif
    endif
    //exit on trailing stop price levels
    if onmarket and priceexit>0 then
    EXITSHORT AT priceexit STOP
    SELL AT priceexit STOP
    endif
    
    SP500.png SP500.png
    #120252 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    E qual’è l’errore di sintassi che ti ha segnalato?

    #120253 quote
    GaspareGaspare
    Participant
    Veteran

    nessuno, infatti l’ho testato sul mini sp500 senza problemi,

    ma chiedevo una conferma, una visione da parte tua.

    #120254 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Mi pare vada bene, errori non ce ne sono, salvo il fatto che ci sono variabili non definite. Ma quelle le conoscerai te.

    #120338 quote
    GaspareGaspare
    Participant
    Veteran

    ok Roberto, grazie

Viewing 12 posts - 31 through 42 (of 42 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

SISTEMA DELLE TRE CANDELE CONSECUTIVE


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Gaspare @gaspare Participant
Summary

This topic contains 41 replies,
has 3 voices, and was last updated by GaspareGaspare
6 years, 7 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 05/28/2019
Status: Active
Attachments: 7 files
ProRealCode ProRealCode
Loading...