[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 930
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
if you don't mind explaining it to me in your own way.
what does :
ticket - unique order number?
I may know the documentation and the manual by heart but it is useless.
I agree, it's too well-written, but it's not at my level, I don't know many smart words.
Is this the magic number of the open order or is it the first or second in the list?
if you don't mind explaining it to me in your own way.
what does :
ticket - unique order number?
I may know the documentation and the manual by heart but it is useless.
I agree, it's too well-written, but it's not at my level, I don't know many smart words.
is it the magic number of the open order, or a serial number like first or second in the list?
Study http://www.alpari.ru/ru/school/textbook/autotrading/expert_advisors/ carefully , in this case the order-sensitive function is to open an order.
The function vvvrzes the number of the ticker (do not confuse with the magic number) of an open position or of a pending order placed. If the OrderSend() function fails, it will return -1.
Each open or pending order is identified by its own unique number.
Help!!! EA trades well on history, but does nothing on the account?
Please, fix the code, so the next trade will not open until the previous one closed by SL or TP. I don't have the strength to test it manually anymore.
Please, fix the code, so the next trade will not open until the previous one closed by SL or TP. I don't have the strength to test it manually anymore.
Something I didn't notice about your code checking if the position is already in the market... Before opening a position, check if there is any position with the same type and the same magic number,
If there is, then there's no need to open anything...
... and you will be happy... :)
I don't see you checking if a position is already in the market... Before opening a position, check to see if there is already a position in the market with the same type and magik and,
If there is, there's no need to open anything...
... and you will be happy... :)
I don't know anything about codes :))
I don't know anything about codes :))
Well, to be honest - it's not an advisor... It's just... a toy for a tester. You cannot use it for real. And if you want to "change" it so much that you can work with it in real life, I doubt anyone will do it for free...
Although... there might be some altruists... but for a good idea. You can't even see the idea in him.
Comrades, please tell me what's the trick ?
From Tutorial :
"ObjectCreate() function... The function returns TRUE if the object was created successfully, otherwise it returns FALSE. To get more information about the error, call GetLastError()."
In my EA, it gives out in Alert - "ObjectCreate=0, ObjectSetText=1" for all graphics creation. It doesn't matter if GetLastError() shows an error or not. The image is created, but why "ObjectCreate=0...? If it must be 1 ? Here is the code:
Dimka-novitsek:
Help!!! EA trades well on the story, but does not do anything on the account?
It's horrible!!! Help in what way? A kind word? :))
Well, how can it be, what does it have to do with it. I am surprised at all. I did not get any error messages, I did nothing, just smiling, but it works in the tester.
//+------------------------------------------------------------------+
//| Dimon's Borders .mq4 |
//| Copyright © 2010, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
//+------------------------------------------------------------------+
//| expert initialisation function |
//+------------------------------------------------------------------+
extern int BandsPeriod=20,i=1 ;extern int BandsShift=0;
extern double BandsDeviations=2.0;
extern double Lots=0.1,TakeProfit=50,stoploss=10 ;double PointX;
int init()
{ if(Digits==5 || Digits==3) PointX = Point * 10; // Correction Point for three or five digits
if(Digits==4 || Digits==2) PointX = Point;
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialisation function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{ int total=OrdersTotal();// Comment(" total ",total); Alert (" total ",total);
if ( total !=0 ){return;}
double Average,Verhnyayaghranytsa,Nyzhnyayaghranytsa,newres,sum,deviation;
string text; int ticket; int err;
text="macd sample";
Average=iMA(NULL,0,BandsPeriod,BandsShift,MODE_SMA,PRICE_CLOSE,i);
int k,counted_bars=IndicatorCounted();
//----
//----
for( k = 0; k<BandsPeriod; k++)
{ newres=Close[k]-Average;//Alert (" Average ",Average);
sum+=((newres*100)*(newres*100))/10000;//Alert (" newres ",newres);
}
deviation=BandsDeviations*MathSqrt(sum/BandsPeriod);
Verhnyayaghranytsa=Average+deviation;
Nyzhnyayaghranytsa=Average-deviation;//Alert (" sum ",sum);
// Alert (" deviation ",deviation);
//----
if (Verhnyayaghranytsa<Close[i])
{ Comment(" buoy ",Verhnyayaghranytsa );
ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-stoploss*PointX,Ask+TakeProfit*PointX, "macd sample",16384,0,Green);
}
if (Nyzhnyayaghranytsa>Close[i])
{ Comment(" sell! ",Nyzhnyayaghranytsa );
ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Bid+stoploss*PointX,Bid-TakeProfit*PointX, "macd sample",16384,0,Red);
Alert (GetLastError());
}
return(0);
}
//+------------------------------------------------------------------+
For sure the OrderSend is correct, he does not give an error, but in the tester, he trades!