Ti stai perdendo delle opportunità di trading:
- App di trading gratuite
- Oltre 8.000 segnali per il copy trading
- Notizie economiche per esplorare i mercati finanziari
Registrazione
Accedi
Accetti la politica del sito e le condizioni d’uso
Se non hai un account, registrati
mmmm si prega di spiegare meglio questo
ho anche provato con boolean e if() ma ad un primo sguardo non ha funzionato
Non posso spiegare di più se non vedo di più...
ma dovete seguire le basi...
doppio a=iCustom(indiA);
doppio b=iCustum(indiB);
doppio c=iCustom(indiC);
int ORDer=0;
if( a==1 && b>0 && c!=0 ) ORDer=1;
if( a==-1 && b<0 && c!=0 ) ORDer=-1;
if(ORDer==1) BUY();
if(ORDer==-1) SELL();
mmmm per favore spiegate di più su questo anche io ho provato booleano e if() ma ad un primo sguardo non ha funzionato
ok ok ok!
qui c'è di più!
double
BuyValueCurrent,
SellValuePrevious,
SellValueCurrent,
BuyValuePrevious2,
BuyValueCurrent2,
SellValuePrevious2,
SellValueCurrent2,
BuyValueCurrent1min,
BuyValueCurrent5min,
BuyValueCurrent21min,
BuyValueCurrent25min,
SellValueCurrent1min,
SellValueCurrent5min,
SellValueCurrent21min,
SellValueCurrent25min,
TrendEnvUp,
TrendEnvDown,
TrendEnvUp1min,
TrendEnvUp5min,
TrendEnvDown1min,
TrendEnvDown5min,
Compra,
Vendi,
StopLong,
StopSell;
[/php]
the icustom funcions and buy sell
BuyValuePrevious = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,0,2);
BuyValueCurrent = iCustom(NULL,0,IndicatorName1,NumBars,1,0);
BuyValuePrevious2 = iCustom(NULL,TimeFrame,IndicatorName2,NumBars,0,2);
BuyValueCurrent2 = iCustom(NULL,0,IndicatorName2,NumBars,0,0);
SellValuePrevious = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,1,2);
SellValueCurrent = iCustom(NULL,0,IndicatorName1,NumBars,0,0);
SellValuePrevious2 = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,1,2);
SellValueCurrent2 = iCustom(NULL,0,IndicatorName2,NumBars,1,0);
BuyValueCurrent1min = iCustom(NULL,1,IndicatorName1,NumBars,1,0);
BuyValueCurrent5min = iCustom(NULL,5,IndicatorName1,NumBars,1,0);
BuyValueCurrent21min = iCustom(NULL,1,IndicatorName2,NumBars,0,0);
BuyValueCurrent25min = iCustom(NULL,5,IndicatorName2,NumBars,0,0);
SellValueCurrent1min = iCustom(NULL,1,IndicatorName1,NumBars,0,0);
SellValueCurrent5min = iCustom(NULL,5,IndicatorName1,NumBars,0,0);
SellValueCurrent21min = iCustom(NULL,1,IndicatorName2,NumBars,1,0);
SellValueCurrent25min = iCustom(NULL,5,IndicatorName2,NumBars,1,0);
TrendEnvUp = iCustom(NULL,0,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0); // trendenvelopes
TrendEnvDown = iCustom(NULL,0,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0); // trendenvelopes
TrendEnvUp1min = iCustom(NULL,1,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0);
TrendEnvUp5min = iCustom(NULL,5,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0);
TrendEnvDown1min = iCustom(NULL,1,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0);
TrendEnvDown5min = iCustom(NULL,5,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0);
BuyCondition = (BuyValueCurrent !=0 && BuyValueCurrent2 !=0 && TrendEnvUp != EMPTY_VALUE)&& (BuyValueCurrent1min !=0 && BuyValueCurrent21min !=0 && TrendEnvUp1min != EMPTY_VALUE) && (BuyValueCurrent5min !=0 && BuyValueCurrent25min !=0 && TrendEnvUp5min != EMPTY_VALUE) ;
SellCondition = (SellValueCurrent !=0 && SellValueCurrent2 !=0 && TrendEnvDown != EMPTY_VALUE)&& (SellValueCurrent1min != 0 && SellValueCurrent21min != 0 && TrendEnvDown1min != EMPTY_VALUE)&& (SellValueCurrent5min != 0 && SellValueCurrent25min != 0 && TrendEnvDown5min != EMPTY_VALUE) ;
StopLong = ((SellValueCurrent !=0 && SellValueCurrent2 !=0) || (TrendEnvDown != EMPTY_VALUE));
StopSell = ((BuyValueCurrent !=0 && BuyValueCurrent2 !=0) || (TrendEnvUp != EMPTY_VALUE));
the exit condition
[php]
StopBuy = (SellValueCurrent !=0 && SellValueCurrent2 !=0 || TrendEnvDown != EMPTY_VALUE);
StopSell = (BuyValueCurrent !=0 && BuyValueCurrent2 !=0 || TrendEnvUp != EMPTY_VALUE);
cambiare questi...
quindi, tutte le condizioni sono false e rimangono false finché le condizioni if() sono vere.
Rimuovi lo StopLong & StopSell in "double", ogni altro "double" può rimanere.
Questo lo farà per voi!
bool BuyCondition=false;
bool SellCondition=falso;
bool StopLong=falso;
bool StopSell=false;
if((BuyValueCurrent !=0 && BuyValueCurrent2 !=0 && TrendEnvUp != EMPTY_VALUE) && (BuyValueCurrent1min !=0 && BuyValueCurrent21min !=0 && TrendEnvUp1min != EMPTY_VALUE) && (BuyValueCurrent5min !=0 && BuyValueCurrent25min !=0 && TrendEnvUp5min != EMPTY_VALUE)) {BuyCondition=true;}
if((SellValueCurrent !=0 && SellValueCurrent2 !=0 && TrendEnvDown != EMPTY_VALUE) && (SellValueCurrent1min != 0 && SellValueCurrent21min != 0 && TrendEnvDown1min != EMPTY_VALUE) && (SellValueCurrent5min != 0 && SellValueCurrent25min != 0 && TrendEnvDown5min != EMPTY_VALUE)) {SellCondition=true;}
if((SellValueCurrent !=0 && SellValueCurrent2 !=0) || (TrendEnvDown != EMPTY_VALUE)) {StopLong=true;}
if((BuyValueCurrent !=0 && BuyValueCurrent2 !=0) || (TrendEnvUp != EMPTY_VALUE)) {StopSell=true;}
ok ok ok!
qui c'è di più!
double
BuyValueCurrent,
SellValuePrevious,
SellValueCurrent,
BuyValuePrevious2,
BuyValueCurrent2,
SellValuePrevious2,
SellValueCurrent2,
BuyValueCurrent1min,
BuyValueCurrent5min,
BuyValueCurrent21min,
BuyValueCurrent25min,
SellValueCurrent1min,
SellValueCurrent5min,
SellValueCurrent21min,
SellValueCurrent25min,
TrendEnvUp,
TrendEnvDown,
TrendEnvUp1min,
TrendEnvUp5min,
TrendEnvDown1min,
TrendEnvDown5min,
Compra,
Vendi,
StopLong,
StopSell;
[/php]the icustom funcions and buy sell
BuyValuePrevious = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,0,2);
BuyValueCurrent = iCustom(NULL,0,IndicatorName1,NumBars,1,0);
BuyValuePrevious2 = iCustom(NULL,TimeFrame,IndicatorName2,NumBars,0,2);
BuyValueCurrent2 = iCustom(NULL,0,IndicatorName2,NumBars,0,0);
SellValuePrevious = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,1,2);
SellValueCurrent = iCustom(NULL,0,IndicatorName1,NumBars,0,0);
SellValuePrevious2 = iCustom(NULL,TimeFrame,IndicatorName1,NumBars,1,2);
SellValueCurrent2 = iCustom(NULL,0,IndicatorName2,NumBars,1,0);
BuyValueCurrent1min = iCustom(NULL,1,IndicatorName1,NumBars,1,0);
BuyValueCurrent5min = iCustom(NULL,5,IndicatorName1,NumBars,1,0);
BuyValueCurrent21min = iCustom(NULL,1,IndicatorName2,NumBars,0,0);
BuyValueCurrent25min = iCustom(NULL,5,IndicatorName2,NumBars,0,0);
SellValueCurrent1min = iCustom(NULL,1,IndicatorName1,NumBars,0,0);
SellValueCurrent5min = iCustom(NULL,5,IndicatorName1,NumBars,0,0);
SellValueCurrent21min = iCustom(NULL,1,IndicatorName2,NumBars,1,0);
SellValueCurrent25min = iCustom(NULL,5,IndicatorName2,NumBars,1,0);
TrendEnvUp = iCustom(NULL,0,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0); // trendenvelopes
TrendEnvDown = iCustom(NULL,0,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0); // trendenvelopes
TrendEnvUp1min = iCustom(NULL,1,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0);
TrendEnvUp5min = iCustom(NULL,5,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,0,0);
TrendEnvDown1min = iCustom(NULL,1,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0);
TrendEnvDown5min = iCustom(NULL,5,IndicatorName4,Ma_Period,Ma_Shift,Ma_Method,Applied_Price,Deviation,1,0);
BuyCondition = (BuyValueCurrent !=0 && BuyValueCurrent2 !=0 && TrendEnvUp != EMPTY_VALUE)&& (BuyValueCurrent1min !=0 && BuyValueCurrent21min !=0 && TrendEnvUp1min != EMPTY_VALUE) && (BuyValueCurrent5min !=0 && BuyValueCurrent25min !=0 && TrendEnvUp5min != EMPTY_VALUE) ;
SellCondition = (SellValueCurrent !=0 && SellValueCurrent2 !=0 && TrendEnvDown != EMPTY_VALUE)&& (SellValueCurrent1min != 0 && SellValueCurrent21min != 0 && TrendEnvDown1min != EMPTY_VALUE)&& (SellValueCurrent5min != 0 && SellValueCurrent25min != 0 && TrendEnvDown5min != EMPTY_VALUE) ;
StopLong = ((SellValueCurrent !=0 && SellValueCurrent2 !=0) || (TrendEnvDown != EMPTY_VALUE));
StopSell = ((BuyValueCurrent !=0 && BuyValueCurrent2 !=0) || (TrendEnvUp != EMPTY_VALUE));
the exit condition
[php]
StopBuy = (SellValueCurrent !=0 && SellValueCurrent2 !=0 || TrendEnvDown != EMPTY_VALUE);
StopSell = (BuyValueCurrent !=0 && BuyValueCurrent2 !=0 || TrendEnvUp != EMPTY_VALUE);
Grazie, proverò questa sera!
una domanda stupida tutto ciò che è dentro il {} è il tuo commento o devo scriverlo io? e perché? perché {;} e non {}; ?
Inoltre, posso ancora usare questo commento giusto?
if(SellCondition)
{
ticket = subOpenOrder(OP_SELL,NewStopLossSell,TakeProfit,TicketComment); // open SELL order
subCheckError(ticket,"SELL");
LastTrade = "SELL";
return(0);
[/php]
or i have to write:
[php]
if(SellCondition = true)
{
ticket = subOpenOrder(OP_SELL,NewStopLossSell,TakeProfit,TicketComment); // open SELL order
subCheckError(ticket,"SELL");
LastTrade = "SELL";
return(0);
Aiuto necessario per codificare un semplice ea, per favore...
Ciao a tutti,
Vorrei ringraziare tutti coloro che mi hanno aiutato in passato. Proprio ora, ho una nuova richiesta.
Qualcuno può aiutarmi a codificare questo ea e qui ci sono i parametri:
Il mio ea si basa su una barra doji e una barra inside.
Per una barra interna:
Mettere un BUY-STOP/BUY-LIMIT all'ALTO della barra successiva
Posizionare un SELL-STOP/SELL-LIMIT al LOW della barra successiva
Chiarimenti:
La barra interna è la barra 0 (zero)
La barra successiva è quella in cui andremo a piazzare il limite di acquisto e di vendita o lo stop
La barra dopo la prossima è quella in cui si attiverà il long o lo short.
Su un grafico di un'ora, se abbiamo una barra interna alle 9 del mattino, allora piazziamo il nostro BUY-STOP o LIMIT e SELL-Stop otr LIMIT al massimo e al minimo della barra delle 10 del mattino. Il long o shor sarà innescato alla barra delle 11 AM se il prezzo sale o scende rispetto alla barra delle 10 AM.
Per una barra Doji:
Posiziona un BUY-STOP/BUY-LIMIT all'ALTO della barra precedente
Posizionare un SELL-STOP/SELL-LIMIT al LOW della barra precedente
Chiarimenti:
La barra Doji è la barra 0 (zero)
La barra precedente o la barra prima della barra doji è quella in cui andremo a piazzare il limite di acquisto e di vendita o lo stop al massimo e al minimo.
La barra dopo la barra doji è il luogo in cui il long o lo short saranno attivati.
Su un grafico di un'ora, se abbiamo una barra doji alle 9 del mattino, allora piazziamo il nostro BUY-STOP o LIMIT e SELL-Stop otr LIMIT al massimo e al minimo della barra delle 8 del mattino. Il long o shor sarà innescato alla barra delle 10 AM a condizione che il prezzo vada più in alto o più in basso della barra delle 8 AM.
...forse, non è così semplice. Se lo fosse stato l'avrei fatto 2 settimane fa.
Grazie in anticipo!
Cordiali saluti,
forexcel
questi non sono commenti, questo è codice.
Sono una parte della vostra dichiarazione if().
if(SellCondition){
...
return(0);
}
if(SellCondition==true){
...
return(0);
}
entrambe le dichiarazioni vanno bene, potete usarne una...
ma vedi che ogni istruzione if() si chiude con }
non si vede nel tuo codice che fornisci qui.
altro esempio:
if(a==b){c=1; d=2; return(0);}
Una domanda stupida: tutto ciò che è dentro il {} è il tuo commento o devo scriverlo io? e perché? perché {;} e non {}; ?
Inoltre posso ancora usare questa dichiarazione giusto?
if(SellCondition)
{
ticket = subOpenOrder(OP_SELL,NewStopLossSell,TakeProfit,TicketComment); // open SELL order
subCheckError(ticket,"SELL");
LastTrade = "SELL";
return(0);
[/php]
or i have to write:
[php]
if(SellCondition = true)
{
ticket = subOpenOrder(OP_SELL,NewStopLossSell,TakeProfit,TicketComment); // open SELL order
subCheckError(ticket,"SELL");
LastTrade = "SELL";
return(0);
ahhhhh ho capito perfettamente, grazie !!!!
Sto rivedendo il mio C del college, è lo stesso
comunque molte grazie!!!
trovato alcuni indicatori per iniziare...
c'è anche un EA, ma non si comporta così bene credo, ho solo fatto un rapido test...