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
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
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
Alla riga 2 inverti Open e Close.
Ovviamente dovrai usare Sellshort invece di Buy.
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
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
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
E qual’è l’errore di sintassi che ti ha segnalato?
nessuno, infatti l’ho testato sul mini sp500 senza problemi,
ma chiedevo una conferma, una visione da parte tua.
Mi pare vada bene, errori non ce ne sono, salvo il fatto che ci sono variabili non definite. Ma quelle le conoscerai te.