Qualsiasi domanda da principiante, per non ingombrare il forum. Professionisti, non passate oltre. Da nessuna parte senza di te - 6. - pagina 471 1...464465466467468469470471472473474475476477478...1178 Nuovo commento Алексей Тарабанов 2014.02.09 21:44 #4701 beginner: può, la domanda è perché non può rates[0].close? Posso solo indovinare: perché l'oggetto non è ancora formato. Oleg 2014.02.09 21:49 #4702 tara: Posso solo supporre: perché l'oggetto non si è ancora formato. No, ci deve essere un errore, dovrebbe essere come in 5, o sono confuso? Алексей Тарабанов 2014.02.09 22:00 #4703 beginner: No, ci deve essere un errore, dovrebbe essere come il 5, o sono confuso? Non dimenticate che Close[0] non esiste, è solo che siamo abituati in modo diverso. Oleg 2014.02.09 22:03 #4704 Close[0] - Il prezzo di chiusura della candela al momento attuale, così come tutti gli altri parametri high, low... Vitalie Postolache 2014.02.09 22:06 #4705 tara: Non dimenticate che Close[0] non esiste, è solo che siamo abituati in modo diverso. non farlo... non esiste... "Non c'è un cucchiaio" (c) ))) Close[0]=Bid, quindi... Алексей Тарабанов 2014.02.09 22:09 #4706 evillive: non farlo... non esiste... "Non c'è nessun cucchiaio" ))) Close[0]=Bid, qui... Dovresti chiedere ai Metakbot, non a me:) Алексей Тарабанов 2014.02.09 22:21 #4707 In modo inesperto, userei qualsiasi riferimento a una citazione che non è ancora stata fatta per disturbare un appello. Pr0t0ip 2014.02.10 18:31 #4708 Ciao, ho il seguente problema. Il registro dà un OrderModify di 130 quando viene testato, aiutatemi a trovare una via d'uscita. Ecco il codice del consigliere: //+------------------------------------------------------------------+ //| Test3.mq4 //| Popov Vladimir | //| http://vk.com/id143715412 | //+------------------------------------------------------------------+ #proprietà copyright "Popov Vladimir" #proprietà link "http://vk.com/id143715412" extern double Lots = 0.1; extern int TakeProfit = 250; extern int StopLoss = 100; extern int Slippage = 10; extern string comment = "Tma bot"; extern int Magic = 123; extern string Indi = "Dati dell'indicatore"; extern string TimeFrame = "time frame corrente"; extern int HalfLength = 20; extern int Price = PRICE_CLOSE; extern double ATRMultiplier = 2.0; extern inttern ATRPeriod = 100; extern bool Interpolate = true; doppio PriceHigh, PriceLow, SL, TP; biglietto int; //+------------------------------------------------------------------+ //| funzione di inizializzazione dell'esperto | //+------------------------------------------------------------------+ int init() { se (cifre == 3 || cifre == 5) { TakeProfit *= 10; StopLoss *= 10; Scivolamento *= 10; } ritorno(0); } //+------------------------------------------------------------------+ //| funzione di deinizializzazione esperto | //+------------------------------------------------------------------+ int deinit() { //---- //---- ritorno(0); } //+------------------------------------------------------------------+ //| funzione di inizio esperto | //+------------------------------------------------------------------+ int start() { PriceHigh = iCustom (Symbol (), 0, "Time", TimeFrame, HalfLength, Price, ATRMultiplier, ATRPeriod, Interpolate, 1, 0); PriceLow = iCustom (Symbol (), 0, "Time", TimeFrame, HalfLength, Price, ATRMultiplier, ATRPeriod, Interpolate, 2, 0); if (Bid >= PriceHigh && CountSell() == 0) { SL = NormalizeDouble(Bid+StopLoss*Point, Digits); SL = NormalizeDouble(Bid-TakeProfit*Point, Digits); ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, 0, 0, 0, comment, Magic, 0, Red); se (biglietto > 0) { if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES) == true) OrderModify(ticket, OrderOpenPrice(), SL, TP, 0); } } if(Ask <= PriceLow && CountBuy() == 0) { SL = NormalizeDouble(Ask-StopLoss*Point, Digits); SL = NormalizeDouble(Ask+TakeProfit*Point, Digits); ticket = OrderSend(Symbol(), OP_BUY, Lots, Bid, Slippage, 0, 0, 0, comment, Magic, 0, Blue); se (biglietto > 0) { if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES) == true) OrderModify(ticket, OrderOpenPrice(), SL, TP, 0); } } se (Ask <= PriceLow && CountSell() > 0) { for(int i=OrdersTotal()-1; i >=0; i--) { if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == true) { if(OrderMagicNumber() == Magic && OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Black); } } } se (Bid >= PriceLow && CountBuy() > 0) { for(i=OrdiniTotali()-1; i >=0; i--) { if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == true) { if(OrderMagicNumber() == Magic && OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Green); } } } ritorno(0); } //+------------------------------------------------------------------+ int CountBuy() { int count = 0; for (int tr = OrdersTotal()-1; tr >= 0; tr --) { OrderSelect(tr, SELECT_BY_POS); if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic) { se (OrderType() == OP_BUY) count++; } } ritorno (count); } //+------------------------------------------------------------------+ int CountSell() { int count = 0; for (int tr= OrdiniTotali()-1; tr >= 0; tr --) { OrderSelect(tr, SELECT_BY_POS); if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic) { se (OrderType() == OP_SELL) count++; } } ritorno (count); } Domande dai principianti MQL5 Tutte le domande dei Scriverò un consulente gratuito Alexander 2014.02.10 18:40 #4709 Correggilo qui SL = NormalizeDouble(Ask-StopLoss*Point, Digits); SL = NormalizeDouble(Ask+TakeProfit*Point, Digits); Nel secondo caso dovrebbe essere TP Pr0t0ip 2014.02.10 18:43 #4710 Oh, cavolo... Grazie, Roger! 1...464465466467468469470471472473474475476477478...1178 Nuovo commento
può, la domanda è perché non può rates[0].close?
Posso solo indovinare: perché l'oggetto non è ancora formato.
Posso solo supporre: perché l'oggetto non si è ancora formato.
No, ci deve essere un errore, dovrebbe essere come in 5, o sono confuso?
No, ci deve essere un errore, dovrebbe essere come il 5, o sono confuso?
Non dimenticate che Close[0] non esiste, è solo che siamo abituati in modo diverso.
non farlo... non esiste...
"Non c'è un cucchiaio" (c) )))
Close[0]=Bid, quindi...
non farlo... non esiste...
"Non c'è nessun cucchiaio" )))
Close[0]=Bid, qui...
Dovresti chiedere ai Metakbot, non a me:)
Ciao, ho il seguente problema. Il registro dà un OrderModify di 130 quando viene testato, aiutatemi a trovare una via d'uscita. Ecco il codice del consigliere:
//+------------------------------------------------------------------+
//| Test3.mq4
//| Popov Vladimir |
//| http://vk.com/id143715412 |
//+------------------------------------------------------------------+
#proprietà copyright "Popov Vladimir"
#proprietà link "http://vk.com/id143715412"
extern double Lots = 0.1;
extern int TakeProfit = 250;
extern int StopLoss = 100;
extern int Slippage = 10;
extern string comment = "Tma bot";
extern int Magic = 123;
extern string Indi = "Dati dell'indicatore";
extern string TimeFrame = "time frame corrente";
extern int HalfLength = 20;
extern int Price = PRICE_CLOSE;
extern double ATRMultiplier = 2.0;
extern inttern ATRPeriod = 100;
extern bool Interpolate = true;
doppio PriceHigh, PriceLow, SL, TP;
biglietto int;
//+------------------------------------------------------------------+
//| funzione di inizializzazione dell'esperto |
//+------------------------------------------------------------------+
int init()
{
se (cifre == 3 || cifre == 5)
{
TakeProfit *= 10;
StopLoss *= 10;
Scivolamento *= 10;
}
ritorno(0);
}
//+------------------------------------------------------------------+
//| funzione di deinizializzazione esperto |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
ritorno(0);
}
//+------------------------------------------------------------------+
//| funzione di inizio esperto |
//+------------------------------------------------------------------+
int start()
{
PriceHigh = iCustom (Symbol (), 0, "Time", TimeFrame, HalfLength, Price, ATRMultiplier, ATRPeriod, Interpolate, 1, 0);
PriceLow = iCustom (Symbol (), 0, "Time", TimeFrame, HalfLength, Price, ATRMultiplier, ATRPeriod, Interpolate, 2, 0);
if (Bid >= PriceHigh && CountSell() == 0)
{
SL = NormalizeDouble(Bid+StopLoss*Point, Digits);
SL = NormalizeDouble(Bid-TakeProfit*Point, Digits);
ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, 0, 0, 0, comment, Magic, 0, Red);
se (biglietto > 0)
{
if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES) == true)
OrderModify(ticket, OrderOpenPrice(), SL, TP, 0);
}
}
if(Ask <= PriceLow && CountBuy() == 0)
{
SL = NormalizeDouble(Ask-StopLoss*Point, Digits);
SL = NormalizeDouble(Ask+TakeProfit*Point, Digits);
ticket = OrderSend(Symbol(), OP_BUY, Lots, Bid, Slippage, 0, 0, 0, comment, Magic, 0, Blue);
se (biglietto > 0)
{
if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES) == true)
OrderModify(ticket, OrderOpenPrice(), SL, TP, 0);
}
}
se (Ask <= PriceLow && CountSell() > 0)
{
for(int i=OrdersTotal()-1; i >=0; i--)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == true)
{
if(OrderMagicNumber() == Magic && OrderType() == OP_SELL)
OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, Black);
}
}
}
se (Bid >= PriceLow && CountBuy() > 0)
{
for(i=OrdiniTotali()-1; i >=0; i--)
{
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == true)
{
if(OrderMagicNumber() == Magic && OrderType() == OP_BUY)
OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, Green);
}
}
}
ritorno(0);
}
//+------------------------------------------------------------------+
int CountBuy()
{
int count = 0;
for (int tr = OrdersTotal()-1; tr >= 0; tr --)
{
OrderSelect(tr, SELECT_BY_POS);
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
se (OrderType() == OP_BUY)
count++;
}
}
ritorno (count);
}
//+------------------------------------------------------------------+
int CountSell()
{
int count = 0;
for (int tr= OrdiniTotali()-1; tr >= 0; tr --)
{
OrderSelect(tr, SELECT_BY_POS);
if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic)
{
se (OrderType() == OP_SELL)
count++;
}
}
ritorno (count);
}
Correggilo qui
Nel secondo caso dovrebbe essere TPOh, cavolo...
Grazie, Roger!