[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 574

 
openlive:
like this maybe i am wrong i am just learning


I'm learning, too )

Why are all ask values (ask1, ask2, ask3) zero?

but the TimeCurrent() function, it reverts the time of the last quote, it needs the price.

If price increases after three last ticks (ask3>ask2>ask1), then open buy order

In any case thanks) !!

 
kellin:
Of course, you should open an order or buy or sell the next or one of the following bars. I also plan to close by an order predicting it by the number of points from the opening.


See trailer. Place its contents in the Experts folder of the terminal. Select the timeframe of the instrument you are interested in and place it on the chart of the Expert Advisor,

Set parameters for opening an order in MetaTrader external variables:

//Внешние переменные 
extern string A0 = "Объем и тип сделки";
extern double Lots = 0.1;         // Объем позиции 
extern bool Buy  = false;         // Открытие длинной позиции            
extern bool Sell = false;         //  Открытие короткой позиции

extern int SlipPips = 3;          // Допустимое Вами проскальзывание цены в настоящих пунктах
                                // Для пятизначных ДЦ пересчитывается автоматически                                     
extern int NumberOfTry = 25;      // Количество попыток открытия ордера

Then you wait for the formation of a new bar on the selected timeframe of the instrument.

When the Expert Advisor opens an order from the market, you compare the time of its opening with the time of the new bar opening.

Files:
1_2.zip  8 kb
 
Vinin:


Assuming that the EA handles every tick, then it is better to do things a little differently


Vinin, thank you very much for your reply. But to be honest I don't really understand why ask1, ask2, ask3 are assigned values 1,-1,-1. What do they mean? If you can not difficultly describe in words what and how it happens, I'm a beginner, not quite well understand everything. I will be very grateful to you).

 
link1:


I'm learning, too )

Why are all ask values (ask1, ask2, ask3) zero?

but the TimeCurrent() function, it reverts the time of the last quote, it needs the price.

The idea is that if price increases after three last ticks (ask3>ask2>ask1), then we open BUY ORDER

In any case thanks) !!

Timecurrent () asks for a new tick, and if the time is new, we assign a new tick to Ask2 or Ask3.

Then, compare Ask1 and Ask2 and Ask3 like this

datetime ask=TimeCurrent();
double ask1=0,ask2=0,ask3=0;
ask1=Ask;
if(ask!=TimeCurrent()){ask2=Ask;ask=TimeCurrent()}
if(ask!=TimeCurrent()){ask3=Ask;}

if((ask1>ask2)&&(ask2>ask3)){......then write the code}

 
link1:


I'm learning, too )

Why are all ask values (ask1, ask2, ask3) zero?

but the TimeCurrent() function, it reverts the time of the last quote, it needs the price.

If price increases (ask3>ask2>ask1), then open buy order

In any case thanks) !!

Timecurrent () asks for a new tick, and if the time is new, we assign a new tick to Ask2 or Ask3.

Then, compare Ask1 and Ask2 and Ask3 like this

datetime ask=TimeCurrent();
double ask1=0,ask2=0,ask3=0;
ask1=Ask;
if(ask!=TimeCurrent()){ask2=Ask;ask=TimeCurrent()}
if(ask!=TimeCurrent()){ask3=Ask;}

if((ask1>ask2)&&(ask2>ask3)){......then write code}

 
link1:


I'm learning, too )

Why are all ask values (ask1, ask2, ask3) zero?

but the TimeCurrent() function, it reverts the time of the last quote, it needs the price.

If price increases after three last ticks (ask3>ask2>ask1), then open buy order

In any case thanks) !!

Timecurrent () asks for a new tick, and if the time is new, we assign a new tick to Ask2 or Ask3.

Then compare asc1 and asc2 and asc3 like this

datetime ask=TimeCurrent();
double ask1=0,ask2=0,ask3=0;
ask1=Ask;
if(ask!=TimeCurrent()){ask2=Ask;ask=TimeCurrent()}
if(ask!=TimeCurrent()){ask3=Ask;}

if((ask1>ask2)&&(ask2>ask3)){......тут пишем код} 
 
openlive:

Timecurrent () asks for a new tick, and if the time is new, assign the value of the new tick to Ask2 or Ask3.

Then compare Ask1 and Ask2 and Ask3 like this

datetime ask=TimeCurrent();
double ask1=0,ask2=0,ask3=0;
ask1=Ask;
if(ask!=TimeCurrent()){ask2=Ask;ask=TimeCurrent()}
if(ask!=TimeCurrent()){ask3=Ask;}

if((ask1>ask2)&&(ask2>ask3)){......then write the code}


I'll give it a try, thanks)
 
openlive:

Timecurrent () asks for a new tick, and if the time is new, assign the value of the new tick to Ask2 or Ask3.

Then compare Ask1 and Ask2 and Ask3 like this

datetime ask=TimeCurrent();
double ask1=0,ask2=0,ask3=0;
ask1=Ask;
if(ask!=TimeCurrent()){ask2=Ask;ask=TimeCurrent()}
if(ask!=TimeCurrent()){ask3=Ask;}

if((ask1>ask2)&&(ask2>ask3)){......then write the code}


I'll give it a try, thanks)
 
link1:

I'll give it a try, thanks)


only in this case ask1 is the oldest price... i.e.

if ((ask2>ask1)&&(ask3>ask2)){......}

 
alkador:

to Armen63

Function "CountBuys" is not referenced and will be removed from exp-file
Function "CountSells" is not referenced and will be removed from exp-file

Reason: