mladen: Questa parte di codice non è sufficiente per concludere qualcosa
Ciao Mladen,
grazie mille per aver dato un'occhiata al mio problema.
Trovi il codice qui sotto che dovrebbe chiudere gli ordini di vendita e di acquisto esistenti.
Dovrebbe anche aprire un nuovo ordine di acquisto o vendita se il trend punta verso la giusta direzione...
//+------------------------------------------------------------------+ //| Signal Exit Buy / Exit Sell) //| Iterate through open tickets //+------------------------------------------------------------------+
grazie mille per aver dato un'occhiata al mio problema.
Trovi il codice qui sotto che dovrebbe chiudere gli ordini di vendita e di acquisto esistenti.
Dovrebbe anche aprire un nuovo ordine di acquisto o di vendita se il trend punta verso la giusta direzione...
//+------------------------------------------------------------------+ //| Signal Exit Buy / Exit Sell) //| Iterate through open tickets //+------------------------------------------------------------------+
Perché stai usando un ciclo all'interno del ciclo? Non ce n'è affatto bisogno. Sbarazzatene, e quando il codice sarà semplificato, tutto sarà più facile da pulire
mladen: Perché stai usando un ciclo all'interno del ciclo? Non ce n'è affatto bisogno. Sbarazzatene, e quando il codice sarà semplificato, tutto sarà più facile da pulire
Ho modificato il codice di conseguenza, pensi che sia meglio ora?
Potresti dare un'occhiata? Questo codice è ancora in uno pseudo stato, non ancora testato.
Grazie in anticipo!
//+-------------------------------------------------------------------------+ //| Signal close Buy / close Sell / Open new BUY or SELL order when possible
int PositionIndex; int TotalNumberOfOrders; TotalNumberOfOrders = OrdersTotal();// store number of Orders in the variable
for(PositionIndex = TotalNumberOfOrders - 1; PositionIndex >= 0 ; PositionIndex --)// for loop to loop through all Orders . . COUNT DOWN TO ZERO ! { if(!OrderSelect(PositionIndex, SELECT_BY_POS, MODE_TRADES)) continue;// if the OrderSelect fails advance the loop to the next PositionIndex
if(OrderMagicNumber() == MagicNumber // does the Order's Magic Number match our EA's magic number ? && OrderSymbol() == Symbol() // does the Order's Symbol match the Symbol our EA is working on ? && (OrderType() == OP_BUY// is the Order a Buy Order ? || OrderType() == OP_SELL )) // or is it a Sell Order ?
if (! OrderClose( OrderTicket(), OrderLots(), OrderClosePrice(), Slippage*PipMultiplier,DarkOrange )) //try to close the order Print("Order Close failed, order number: ", OrderTicket(), " Error: ", GetLastError()); //if the Order Close failed print some helpful information
if(trendNow>0 && (NLD1>NLD2) && RSIfilter>52) // Check if new entry condition is given { OpenBuy_=true; } else if(trendPrev>0 && (NLD1<NLD2) && RSIfilter<42) { OpenSell_=true; } } // end of For loop
Ho modificato il codice di conseguenza, pensi che sia meglio ora?
Potresti dare un'occhiata? Questo codice è ancora in uno pseudo stato, non ancora testato.
Grazie in anticipo!
//+-------------------------------------------------------------------------+ //| Signal close Buy / close Sell / Open new BUY or SELL order when possible
int PositionIndex; int TotalNumberOfOrders; TotalNumberOfOrders = OrdersTotal();// store number of Orders in the variable
for(PositionIndex = TotalNumberOfOrders - 1; PositionIndex >= 0 ; PositionIndex --)// for loop to loop through all Orders . . COUNT DOWN TO ZERO ! { if(!OrderSelect(PositionIndex, SELECT_BY_POS, MODE_TRADES)) continue;// if the OrderSelect fails advance the loop to the next PositionIndex
if(OrderMagicNumber() == MagicNumber // does the Order's Magic Number match our EA's magic number ? && OrderSymbol() == Symbol() // does the Order's Symbol match the Symbol our EA is working on ? && (OrderType() == OP_BUY// is the Order a Buy Order ? || OrderType() == OP_SELL )) // or is it a Sell Order ?
if (! OrderClose( OrderTicket(), OrderLots(), OrderClosePrice(), Slippage*PipMultiplier,DarkOrange )) //try to close the order Print("Order Close failed, order number: ", OrderTicket(), " Error: ", GetLastError()); //if the Order Close failed print some helpful information
if(trendNow>0 && (NLD1>NLD2) && RSIfilter>52) // Check if new entry condition is given { OpenBuy_=true; } else if(trendPrev>0 && (NLD1<NLD2) && RSIfilter<42) { OpenSell_=true; } } // end of For loop
Here is the EA for B& S with 15 warnings left. If some one could tell me how to clear Declaration of global such as “declaration of 'trailingprofit' hides global declaration at line 62 mnt-BuyersSellers EA v1.00.mq4 915 53” I will clear it up.
I also need a few files to run it.
2016.12.17 16:01:35.347 2016.11.01 00:47 cannot open file 'C:\FXPrograms\Tallinex\MQL4\indicators\4BARS-MTF-BBH 1.06.ex4' [2]
2016.12.17 16:01:29.815 2016.11.01 00:17 cannot open file 'C:\FXPrograms\Tallinex\MQL4\indicators\BullBearHelper 1.00.ex4' [2]
2016.12.17 16:01:29.815 2016.11.01 00:17 cannot open file 'C:\FXPrograms\Tallinex\MQL4\indicators\AdaptiveLaguerreFilter.ex4' [2]
Grazie per il tuo interesse, il pacchetto indi è allegato, in realtà l'intero sistema è da FF (http://www.tradingsystemforex.com/ideas-for-expert-advisors/4662-buyers-sellers-ea.html)
gspe stava lavorando su di esso, ma penso che l'intero EA frame è da "funyoo" e io sono solo interessato al codice EA come campione / modello di frame per creare qualche nuovo EA con, il resto della loro strategia non è frutta completa come per la mia ipotesi, possiamo formare meglio di quello, abbiamo 100 volte meglio indicatori per ora :)
E se aggiungiamo "t" prima di quella di (dichiarazione di ..... nascondere la dichiarazione globale) tutti gli avvertimenti saranno rimossi ma non sono sicuro che sia corretto? ..... ho preso questo suggerimento dal thread (https://www.forex-tsd.com/forum/debates-discussions/18543-ea-not-working-under-build-610) e dalla lunga conversazione/argomento di due pagine in mezzo
"crsnapebtinternetcom" e MLADEN ..... poi ho testato e ha funzionato ma ha bisogno di qualche certificazione :)
Grazie per il tuo interesse, il pacchetto indi è allegato, in realtà l'intero sistema è da FF (http://www.tradingsystemforex.com/ideas-for-expert-advisors/4662-buyers-sellers-ea.html)
gspe stava lavorando su di esso, ma penso che l'intero EA frame è da "funyoo" e io sono solo interessato al codice EA come campione / modello di frame per creare qualche nuovo EA con, il resto della loro strategia non è frutta completa come per la mia ipotesi, possiamo formare meglio di quello, abbiamo 100 volte meglio indicatori per ora :)
saluti
Ragazzi
Gli EA di Funyoos di solito hanno mostrato buoni risultati quando si usa la martingala nel back test. Io starei molto attento quando li uso
Consenti l'uso dei cookie per accedere al sito MQL5.com.
Abilita le impostazioni necessarie nel browser, altrimenti non sarà possibile accedere.
Hai effettuato l'accesso. L'autenticazione a due fattori è stata disattivata. Configurala di nuovo e scansiona un nuovo codice QR, oppure continua con l'autenticazione a due fattori disattivata.
Ciao Pro-Coders,
Mi chiedo se qualcuno può aiutarmi,
Vorrei che il mio EA aprisse un Buy Trade e chiudesse un Sell Trade esistente al cambio di trend.
Lo fa, ma solo quando ha preso profitto. Quando il trend cambia mentre la posizione è ancora
aperta, funziona in StopLoss. (Vedi immagine). A volte funziona e a volte no.
Cosa potrei migliorare?
if(trendNow>0 && (NLD1>NLD2) && RSIfilter>55)
{
OpenBuy_ =true;
CloseSell_=true;
}
else
if(trendPrev>0 && (NLD1<NLD2) && RSIfilter<45)
{
OpenSell_=true;
CloseBuy_=true;
}
Questa parte di codice non è sufficiente per concludere qualcosa
Ciao Mladen,
grazie mille per aver dato un'occhiata al mio problema.
Trovi il codice qui sotto che dovrebbe chiudere gli ordini di vendita e di acquisto esistenti.
Dovrebbe anche aprire un nuovo ordine di acquisto o vendita se il trend punta verso la giusta direzione...
//+------------------------------------------------------------------+
//| Signal Exit Buy / Exit Sell)
//| Iterate through open tickets
//+------------------------------------------------------------------+
for(int i=0; i<Total; i++)
{
dummyResult=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY && OrderMagicNumber()==MagicNumber)
{
for(int z=OrdersTotal()-1; z>=0; z--)
{
if(OrderSelect(z,SELECT_BY_POS,MODE_TRADES) && OrderMagicNumber()==MagicNumber && OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY)
buy_ticket=OrderTicket();
else
if(OrderType()== OP_SELL)
sell_ticket=OrderTicket();
}
// Close BUY
if(CloseBuy_==true && buy_ticket!=0)
{
dummyResult=OrderClose(OrderTicket(),OrderLots(),Bid,Slippage*PipMultiplier,MediumSeaGreen);
if(EachTickMode) TickCheck = True;
if(!EachTickMode) BarCount = Bars;
Print("Error closing Buy #",(string)OrderTicket()," Error code ",(string)GetLastError());
// Open new Sell Order
if(trendPrev>0 && (NLD1<NLD2) && RSIfilter<45) OpenSell_=true;
}
// Close SELL
if(CloseSell_==true && sell_ticket!=0)
{
dummyResult=OrderClose(OrderTicket(),OrderLots(),Ask,Slippage*PipMultiplier,DarkOrange);
if(EachTickMode) TickCheck = True;
if(!EachTickMode) BarCount = Bars;
Print("Error closing Sell #",(string)OrderTicket()," Error code ",(string)GetLastError());
// Open new Buy Order
if(trendNow>0 && (NLD1>NLD2) && RSIfilter>55) OpenBuy_ =true;
}}
Ciao Mladen,
grazie mille per aver dato un'occhiata al mio problema.
Trovi il codice qui sotto che dovrebbe chiudere gli ordini di vendita e di acquisto esistenti.
Dovrebbe anche aprire un nuovo ordine di acquisto o di vendita se il trend punta verso la giusta direzione...
//+------------------------------------------------------------------+
//| Signal Exit Buy / Exit Sell)
//| Iterate through open tickets
//+------------------------------------------------------------------+
for(int i=0; i<Total; i++)
{
dummyResult=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderType()<=OP_SELL && OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY && OrderMagicNumber()==MagicNumber)
{
for(int z=OrdersTotal()-1; z>=0; z--)
{
if(OrderSelect(z,SELECT_BY_POS,MODE_TRADES) && OrderMagicNumber()==MagicNumber && OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY)
buy_ticket=OrderTicket();
else
if(OrderType()== OP_SELL)
sell_ticket=OrderTicket();
}
// Close BUY
if(CloseBuy_==true && buy_ticket!=0)
{
dummyResult=OrderClose(OrderTicket(),OrderLots(),Bid,Slippage*PipMultiplier,MediumSeaGreen);
if(EachTickMode) TickCheck = True;
if(!EachTickMode) BarCount = Bars;
Print("Error closing Buy #",(string)OrderTicket()," Error code ",(string)GetLastError());
// Open new Sell Order
if(trendPrev>0 && (NLD1<NLD2) && RSIfilter<45) OpenSell_=true;
}
// Close SELL
if(CloseSell_==true && sell_ticket!=0)
{
dummyResult=OrderClose(OrderTicket(),OrderLots(),Ask,Slippage*PipMultiplier,DarkOrange);
if(EachTickMode) TickCheck = True;
if(!EachTickMode) BarCount = Bars;
Print("Error closing Sell #",(string)OrderTicket()," Error code ",(string)GetLastError());
// Open new Buy Order
if(trendNow>0 && (NLD1>NLD2) && RSIfilter>55) OpenBuy_ =true;
}}
Perché stai usando un ciclo all'interno del ciclo? Non ce n'è affatto bisogno. Sbarazzatene, e quando il codice sarà semplificato, tutto sarà più facile da pulire
Ciao Mladen,
Ho modificato il codice di conseguenza, pensi che sia meglio ora?
Potresti dare un'occhiata? Questo codice è ancora in uno pseudo stato, non ancora testato.
Grazie in anticipo!
//+-------------------------------------------------------------------------+
int PositionIndex;//| Signal close Buy / close Sell / Open new BUY or SELL order when possible
int TotalNumberOfOrders;
TotalNumberOfOrders = OrdersTotal();// store number of Orders in the variable
for(PositionIndex = TotalNumberOfOrders - 1; PositionIndex >= 0 ; PositionIndex --)// for loop to loop through all Orders . . COUNT DOWN TO ZERO !
{
if(!OrderSelect(PositionIndex, SELECT_BY_POS, MODE_TRADES)) continue;// if the OrderSelect fails advance the loop to the next PositionIndex
if(OrderMagicNumber() == MagicNumber // does the Order's Magic Number match our EA's magic number ?
&& OrderSymbol() == Symbol() // does the Order's Symbol match the Symbol our EA is working on ?
&& (OrderType() == OP_BUY // is the Order a Buy Order ?
|| OrderType() == OP_SELL )) // or is it a Sell Order ?
if (! OrderClose( OrderTicket(), OrderLots(), OrderClosePrice(), Slippage*PipMultiplier,DarkOrange )) //try to close the order
Print("Order Close failed, order number: ", OrderTicket(), " Error: ", GetLastError()); //if the Order Close failed print some helpful information
if(trendNow>0 && (NLD1>NLD2) && RSIfilter>52) // Check if new entry condition is given
{
OpenBuy_=true;
}
else
if(trendPrev>0 && (NLD1<NLD2) && RSIfilter<42)
{
OpenSell_=true;
}
} // end of For loop
Ciao Mladen,
Ho modificato il codice di conseguenza, pensi che sia meglio ora?
Potresti dare un'occhiata? Questo codice è ancora in uno pseudo stato, non ancora testato.
Grazie in anticipo!
//+-------------------------------------------------------------------------+
int PositionIndex;//| Signal close Buy / close Sell / Open new BUY or SELL order when possible
int TotalNumberOfOrders;
TotalNumberOfOrders = OrdersTotal();// store number of Orders in the variable
for(PositionIndex = TotalNumberOfOrders - 1; PositionIndex >= 0 ; PositionIndex --)// for loop to loop through all Orders . . COUNT DOWN TO ZERO !
{
if(!OrderSelect(PositionIndex, SELECT_BY_POS, MODE_TRADES)) continue;// if the OrderSelect fails advance the loop to the next PositionIndex
if(OrderMagicNumber() == MagicNumber // does the Order's Magic Number match our EA's magic number ?
&& OrderSymbol() == Symbol() // does the Order's Symbol match the Symbol our EA is working on ?
&& (OrderType() == OP_BUY // is the Order a Buy Order ?
|| OrderType() == OP_SELL )) // or is it a Sell Order ?
if (! OrderClose( OrderTicket(), OrderLots(), OrderClosePrice(), Slippage*PipMultiplier,DarkOrange )) //try to close the order
Print("Order Close failed, order number: ", OrderTicket(), " Error: ", GetLastError()); //if the Order Close failed print some helpful information
if(trendNow>0 && (NLD1>NLD2) && RSIfilter>52) // Check if new entry condition is given
{
OpenBuy_=true;
}
else
if(trendPrev>0 && (NLD1<NLD2) && RSIfilter<42)
{
OpenSell_=true;
}
} // end of For loop
Mntiwana
Here is the EA for B& S with 15 warnings left. If some one could tell me how to clear Declaration of global such as “declaration of 'trailingprofit' hides global declaration at line 62 mnt-BuyersSellers EA v1.00.mq4 915 53” I will clear it up.
I also need a few files to run it.
2016.12.17 16:01:35.347 2016.11.01 00:47 cannot open file 'C:\FXPrograms\Tallinex\MQL4\indicators\4BARS-MTF-BBH 1.06.ex4' [2]
2016.12.17 16:01:29.815 2016.11.01 00:17 cannot open file 'C:\FXPrograms\Tallinex\MQL4\indicators\BullBearHelper 1.00.ex4' [2]
2016.12.17 16:01:29.815 2016.11.01 00:17 cannot open file 'C:\FXPrograms\Tallinex\MQL4\indicators\AdaptiveLaguerreFilter.ex4' [2]
And ,"Slope Direction Line"
Let me Know
Ray
traderduke
Grazie per il tuo interesse, il pacchetto indi è allegato, in realtà l'intero sistema è da FF (http://www.tradingsystemforex.com/ideas-for-expert-advisors/4662-buyers-sellers-ea.html)
gspe stava lavorando su di esso, ma penso che l'intero EA frame è da "funyoo" e io sono solo interessato al codice EA come campione / modello di frame per creare qualche nuovo EA con, il resto della loro strategia non è frutta completa come per la mia ipotesi, possiamo formare meglio di quello, abbiamo 100 volte meglio indicatori per ora :)
saluti
"crsnapebtinternetcom" e MLADEN ..... poi ho testato e ha funzionato ma ha bisogno di qualche certificazione :)
saluti
traderduke
Grazie per il tuo interesse, il pacchetto indi è allegato, in realtà l'intero sistema è da FF (http://www.tradingsystemforex.com/ideas-for-expert-advisors/4662-buyers-sellers-ea.html)
gspe stava lavorando su di esso, ma penso che l'intero EA frame è da "funyoo" e io sono solo interessato al codice EA come campione / modello di frame per creare qualche nuovo EA con, il resto della loro strategia non è frutta completa come per la mia ipotesi, possiamo formare meglio di quello, abbiamo 100 volte meglio indicatori per ora :)
saluti
Ragazzi
Gli EA di Funyoos di solito hanno mostrato buoni risultati quando si usa la martingala nel back test. Io starei molto attento quando li uso