Buonasera,
dovrei andare avanti con questa codifica ma non riesco a codificare questa parte
“”and ultimo mySupport del trendlong> myResistenza del trendshort “”
nell immagine allegata vediamo gli idicatori di Roberto Gozzi dove
il magic trend castom verde indica il trend long e rosso il trend short.
sono cerchiati l’ultimo supporto del trend long e la resistenza del trend short
avrei bisogno di un’aiuto
grazie mille
myMagicTrend = CALL "Magic Trend custom"[20, 14, 1, 5]
mydownT = CALL "Magic Trend downT"[20, 14, 1, 5]
myupT = CALL "Magic Trend upT"[20, 14, 1, 5]
myResistenza = CALL "Resistenza"[1, 5]
mySupporto = CALL "Supporto"[1, 5]
///TREND LONG -----------------------------
ONCE trendlong = 0
IF StrategyProfit <> StrategyProfit[1] THEN
trendlong = 0
ENDIF
Medialong = myMagicTrend
IF mydownT crosses under Medialong[1] OR longOnMarket THEN
trendlong = 0
ENDIF
IF trendlong = 0 THEN
trendlong = myupT crosses over Medialong[1]
ENDIF
/////TREND SHORT------------------------------------------
ONCE trendshort = 0
IF StrategyProfit <> StrategyProfit[1] THEN
trendshort = 0
ENDIF
Media = myMagicTrend
IF myupT crosses over Media[1] OR shortOnMarket THEN
trendshort = 0
ENDIF
IF trendshort = 0 THEN
trendshort = mydownT crosses under Media[1]
ENDIF
myResistenza = CALL "Resistenza"[1, 5]
IF Not shortOnMarket and trendshort and myResistenza >0 ""and ultimo mySupport>0 del trendlong> myResistenza>0 del trendshort "" THEN//
sellshort 1 CONTRACT AT market
SET STOP LOSS 20
set target profit 30
ENDIF
Si prega di allegare l'immagine di cui hai parlato e il codice per la resistenza e il supporto.
//DEFPARAM CalculateOnLastBars = 1000
PivotBAR = pivot//2 //2 bars AFTER pivot
LookBack = nbarre//5 //4 bars BEFORE pivot
ResistancePrice = 0
//SupportPrice = 0
BarLookBack = PivotBAR + 1
//IF low[PivotBAR] < lowest[LookBack](low)[BarLookBack] THEN
//IF low[PivotBAR] = lowest[BarLookBack](low) THEN
//SupportPrice = low[PivotBAR]
//ENDIF
//ENDIF
IF high[PivotBAR] > highest[LookBack](high)[BarLookBack] THEN
IF high[PivotBAR] = highest[BarLookBack](high) THEN
ResistancePrice = high[PivotBAR]//high[BarIndex - MyResistance]
ENDIF
ENDIF
RETURN ResistancePrice
//DEFPARAM CalculateOnLastBars = 1000
PivotBAR = pivot//2 //2 bars AFTER pivot
LookBack = nbarre//5 //4 bars BEFORE pivot
//ResistancePrice = 0
SupportPrice = 0
BarLookBack = PivotBAR + 1
IF low[PivotBAR] < lowest[LookBack](low)[BarLookBack] THEN
IF low[PivotBAR] = lowest[BarLookBack](low) THEN
SupportPrice = low[PivotBAR]
ENDIF
ENDIF
//IF high[PivotBAR] > highest[LookBack](high)[BarLookBack] THEN
//IF high[PivotBAR] = highest[BarLookBack](high) THEN
//ResistancePrice = high[PivotBAR]//high[BarIndex - MyResistance]
//ENDIF
//ENDIF
RETURN SupportPrice
La linea 34 è errata, puoi riscriverla correttamente?
buongiorno Roberto,
è proprio quello che non so fare!
non so scrivere quello contenuto nelle doppie virgolette della riga 34
e cioè che (per gli ingressi short)durante il trend short rosso, la resistenza che si forma deve essere minore dell’ultimo supporto del trend long.
Grazie per la disponibilità
Max
Probabilmente l’ho scritta io, ma non riesco a trovarla tra le migliaia di codici scritti, puoi inviarmi un link al post dove l’hai trovata?
gli indicatori postati sono i tuoi ma la riga l’ho scritta io ….per lo meno ci ho provato
Non capisco:
- sei nel codice per entrare SHORT, cosa c’entra il trendlong?
- inoltre usi la parola DEL con trendlong e trendshort, ma sono due variabili di tipo logico, contengono solo 0 e 1 e non capisco cosa significhi quel DEL.
E’ meglio se mi scrivi quali sono le regole per entrare (solo SHORT, o anche LONG?), così le ricodifico.
Hai ragione Roberto,
è difficile farmi capire ho usato nelle virgolette metà linguaggio discorsivo e metà codice
il del è usato come preposizione.
ho scritto sul disegno i punti da seguire per ottenere il segnale che vorrei
spero di aver trasmesso quello che intendo
Max
Puoi postare anche i due indicatori “Magic Trend downT” e “Magic Trend upT” (magari allegando anche i file ITF) ?
Prova questo, ma non ho ben capito le condizioni d’entrata:
ONCE SegnaleLong = 0
ONCE SegnaleShort = 0
ONCE BullTrend = 0
ONCE BearTrend = 0
ONCE UltimaResist = 0
ONCE UltimoSupporto = 0
//
myMagicTrend = CALL "Magic Trend custom"[20, 14, 1, 5]
mydownT = CALL "Magic Trend downT"[20, 14, 1, 5]
myupT = CALL "Magic Trend upT"[20, 14, 1, 5]
myResistenza = CALL "Resistenza"[1, 5]
mySupporto = CALL "Supporto"[1, 5]
//
IF BullTrend THEN
BullTrend = myMagicTrend >= myMagicTrend[1]
IF BullTrend THEN
BearTrend = 0
ENDIF
ELSE
BullTrend = myMagicTrend > myMagicTrend[1]
IF BullTrend THEN
BearTrend = 0
ENDIF
ENDIF
//
IF BearTrend THEN
BearTrend = myMagicTrend <= myMagicTrend[1]
IF BearTrend THEN
BullTrend = 0
ENDIF
ELSE
BearTrend = myMagicTrend < myMagicTrend[1]
IF BearTrend THEN
BullTrend = 0
ENDIF
ENDIF
//
IF BullTrend THEN
UltimoSupporto = mySupporto
ELSIF BearTrend THEN
UltimaResist = myResistenza
ENDIF
//
///TREND LONG -----------------------------
ONCE trendlong = 0
IF StrategyProfit <> StrategyProfit[1] THEN
trendlong = 0
ENDIF
Medialong = myMagicTrend
IF mydownT crosses under Medialong[1] OR longOnMarket THEN
trendlong = 0
ENDIF
IF trendlong = 0 THEN
trendlong = myupT crosses over Medialong[1]
ENDIF
/////TREND SHORT------------------------------------------
ONCE trendshort = 0
IF StrategyProfit <> StrategyProfit[1] THEN
trendshort = 0
ENDIF
Media = myMagicTrend
IF myupT crosses over Media[1] OR shortOnMarket THEN
trendshort = 0
ENDIF
IF trendshort = 0 THEN
trendshort = mydownT crosses under Media[1]
ENDIF
IF Not shortOnMarket and trendshort and myResistenza < UltimoSupporto THEN
sellshort 1 CONTRACT AT market
SET STOP LOSS 20
set target profit 30
ENDIF
IF Not LongOnMarket and trendlong and mySupporto > UltimaResist THEN
Buy 1 CONTRACT AT market
SET STOP LOSS 20
set target profit 30
ENDIF
Grazie Roberto,
non va,
ho inserito” graphonprice ultimosupporto” e si vede che li segnala tutti i supporti del trend long e non l’ultimo supporto prima che il trend diventi short.
Per ingresso short dovrebbe considerare solo il supporto cerchiato (ultimo supporto del trend long prima che diventi trend short) che deve essere maggiore della resistenza dentro il rettangolo(resistenza del trend short).
il ragionamento è : se la resistenza è minore del supporto nei relativi trend ,possa essere partito un movimento di mercato e non sia in fase laterale.
Un Saluto
Max