[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 940

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
extern double TP=20; // ТР для открываемого ордера
extern double Lot=0.01; // Жестко заданное колич. лотов
datetime time;
//--------------------------------------------------------------- 2 --
int start()
{
int Total;
double
M_0,
M_1;
bool
Ans =false, // Ответ сервера после закрытия
Cls_B=false, // Критерий для закрытия Buy
Cls_S=false, // Критерий для закрытия Sell
Opn_B=false, // Критерий для открытия Buy
Opn_S=false; // Критерий для открытия Sell
//--------------------------------------------------------------- 3 --
// Учёт ордеров
for(int i=OrdersTotal()-1;i>=0;i--)
if (OrderSelect(i,SELECT_BY_POS)&&OrderSymbol()==Symbol()&&OrderType()>1)Total++;
if(Total!=0 || time==Time[1])return;
// Торговые критерии
M_0=iOsMA(NULL,0,13,34,8,0,0); // 0 бар
M_1=iOsMA(NULL,0,13,34,8,0,1); // 1 бар
if (M_1<0 && M_0>0)
Opn_B=true;
if (M_1>0 && M_0<0)
Opn_S=true;
//--------------------------------------------------------------- 7 --
if (Opn_B)
{OrderSend(Symbol(),OP_BUY,Lot,Ask,0,Bid-SL*Point,Bid+TP*Point);time=Time[1];}
if (Opn_S)
{OrderSend(Symbol(),OP_SELL,Lot,Bid,0,Ask+SL*Point,Ask-TP*Point);time=Time[1];}
}
Are you testing on all ticks?
Thanks for the reply. Sketched out a rudimentary EA. Still doesn't work.
in this code, look for errors, OrderSend function press F1 will bring up help in the standard editor, look at the order of incoming parameters there is an error.
+ use Print / Alert to go through the variable values, insert it in the code section after ( assignments / execute )
and remember to normalize the output, DoubletoSt..NormalizeDouble..TimeToStr
Attached here are 2 free libraries with code by kimIV.
The code is simple, ready made functions, very good for beginners.
// Hardly a set number of lots :)
Yes
Then you have a chattering effect on the zero bar.
Testing on all the ticks?
How to "stop" the flow of displeasure to DCs?
Below is an extract from the log:
10:00:25 Old tick EURUSD30 1.38730/1.38740
10:00:25 Old tick EURUSD240 1.38730/1.38740
10:00:25 Old tick EURUSD1440 1.38730/1.38740
10:00:25 Old tick EURUSD15 1.38730/1.38740
10:00:25 Old tick EURUSD1 1.38730/1.38740
10:00:25 Old tick EURUSD60 1.38730/1.38740
10:00:25 Old tick EURUSD5 1.38730/1.38740
11:00:34 Old tick EURUSD30 1.38847/1.38863
11:00:34 Old tick EURUSD240 1.38847/1.38863
11:00:34 Old tick EURUSD1440 1.38847/1.38863
11:00:34 Old tick EURUSD15 1.38847/1.38863
11:00:34 Old tick EURUSD1 1.38847/1.38863
11:00:34 Old tick EURUSD60 1.38847/1.38863
11:00:34 Old tick EURUSD5 1.38847/1.38863
11:25:06 Old tick EURUSD30 1.38707/1.38722
11:25:06 Old tick EURUSD240 1.38707/1.38722
11:25:06 Old tick EURUSD1440 1.38707/1.38722
11:25:06 Old tick EURUSD15 1.38707/1.38722
11:25:06 Old tick EURUSD1 1.38707/1.38722
11:25:06 Old tick EURUSD60 1.38707/1.38722
Then you have a chattering effect on the zero bar.
Does the test give you a headache ?
//Trading criteria
M_0 ={ iOsMA(0,0,13,34,8,0,1) }; //| 1bar
M_1 ={ iOsMA(0,0,13,34,8,0,2) }; //| 2bar
Opn_B ={ (((M_1<0)==1) &&((M_0>0)==1) ) };
Opn_S ={ (((M_1>0)==1) &&((M_0<0)==1) ) };
try it this way, but without the jarring:)