I will write a free mql4 advisor - page 3

 
Andrey Vaskin:
To gain experience in this area, I will write 25 EAs for free for your interesting ideas and strategies

1.Look at the price cupFORTS.


2.Buy if within 1 minute the red bar was 3 times* the blue bar. Sell if it is the opposite.


3.Close a position you bought - if the blue bar was 3 times the red bar in 1 minute. Close a position that has been sold, if within 1 minute, the red bar was 3 times greater than the blue bar.


4) The cycle repeats.

---


*Means 3 times or more.

"3 times" and "1 minute" must be set in the owl parameters.

A StopLoss is also needed.

A picture of the stack (volume of sell/buy orders):

The volumes can also be taken from the market overview:

 
Alexander Pavlov:

1.Look at the price glass.


2.Buy if within 1 minute the red bar was 3 times* the blue bar. Sell if it is the opposite.


3.Close a purchased position - if the blue bar is 3 times the red bar in 1 minute. Close a position that has been sold, if within 1 minute, the red bar was 3 times greater than the blue bar.


4) The cycle repeats.

---


*Means 3 times or more.

"3 times" and "1 minute" must be set in the owl parameters.

A StopLoss is also needed.

A picture of the stack (volume of sell/buy orders):

Volumes can also be taken from the market overview:

This is MT5, the author only asked for tasks under MT4.
 
Vitaly Muzichenko:

They are about stochastics, RSI MACD and other junk called oscillators, they draw the story very nicely, but I have not met a single Expert Advisor that has even held a balance, let alone made a profit.

But people hoping for something are constantly churning out these useless indicators.

I think it is very strange that they come from one version of MT to another for several years. Who needs them? Probably just for a sample program code, but people think that to trade on them ))))

Junk? OK, show me an example of NOT junk. Also, just because you haven't seen something doesn't mean it doesn't exist.
 
Tapochun:
Junk? Well, give me an example of something that is NOT rubbish. Also, just because you haven't seen something doesn't mean it's not there.
The only thing I've seen that isn't junk is on candlestick patterns.
 
Vitaly Muzichenko:
The only thing I've seen that's not draining is on candlestick patterns.
Mine isn't draining either, and that's your word. and there are no patterns there.
 
Leanid Aladzyeu:
Mine is not flush either, and those are your words. and there are no patterns.
I didn't mean mathematics at the moment. I wrote about pure indicator. Yours is good.
 

help fix

EA puts 4 pending orders

2 buy and sell stop

2 buy and sell limit

i don't know how to interchange pending orders but i don't know at what distance an order should be placed

it is the same with buy positions and sell stop

After all orders are placed a new one should be placed before a new order triggers

i got lots of losing lots but they would be minus if i switched orders


//| iiiiiiiiiiiiiiiiii_buy_sell.mq4 |

//| |

//| |

//+------------------------------------------------------------------+

extern int N = 100; // bays and sells (counting separately) allowed to have a hundred pieces each


extern double Lots = 0.01; // lot


extern int PROF = 100; // trawl stop, begin with a hundred pips profit

extern int TS = 200; // pull it on stop behind the price

extern int STEP = 200; // distance between bids

extern int TP = 10000; //take order

extern int SL = 10000; // take orders

extern bool Buy = false; // buy only

extern bool Sell = true; // sell only

extern double PROSADKA = 0.5; // when equity is equal or less than this fraction of balance

extern int magicbuy = 777;

extern int magicsell = 888;


int M;

double buystop_OP, sellstop_OP;

double selllimit_OP, buylimit_OP;


int start()

{

// ---------------------------------------------------------------------


// ---------------------------------------------------------------------

// see what orders we have:

int buy = 0,sell = 0;

int buystop = 0,sellstop = 0;

int selllimit = 0,buylimit = 0;

int buys = 0, sells = 0;

int Total = 0;

for(int i = 0; i < OrdersTotal(); i ++)

{

OrderSelect(i, SELECT_BY_POS, MODE_TRADES);

if(OrderMagicNumber() != magicbuy && OrderMagicNumber() != magicsell) continue;

if(OrderType() == OP_BUYSTOP)

buystop = OrderTicket();

if(OrderType() == OP_BUYLIMIT)

buylimit = OrderTicket();

if(OrderType() == OP_BUYSTOP || OrderType() == OP_BUYLIMIT || OrderType() == OP_BUY)

buys ++;

if(OrderType() == OP_SELLSTOP)

sellstop = OrderTicket();

if(OrderType() == OP_SELLLIMIT)

selllimit = OrderTicket();

if(OrderType() == OP_SELLSTOP || OrderType() == OP_SELLLIMIT || OrderType() == OP_SELL )

sells ++;

Total ++;

}

// ---------------------------------------------------------------------

int LET = 0;

if (AccountEquity()/AccountBalance() < PROSADKA)

LET = 1; // if drawdown is high - prohibition to place new positions

// ---------------------------------------------------------------------

// setting new trades :

if(LET == 0 && TimeCurrent() && M != iTime(Symbol(),1,0)) // once a minute

{

if ( buystop < 1 && buys < N && Buy == true)

{

buystop_OP = NormalizeDouble(Ask+STEP*Point,Digits);

buystop = OrderSend(Symbol(),OP_BUYSTOP,Lots,buystop_OP,10,buystop_OP-SL*Point,buystop_OP+TP*Point,NULL,magicbuy,0,Blue);

}

if ( buylimit < 1 && buys < N && Buy == True)

{

buylimit_OP = NormalizeDouble(Ask-STEP*Point,Digits);

buylimit = OrderSend(Symbol(),OP_BUYLIMIT,Lots,buylimit_OP,100,buylimit_OP-SL*Point,buylimit_OP+TP*Point,NULL,magicbuy,0,Red);

}

if ( sellstop < 1 && sells < N && Sell == true)

{

sellstop_OP = NormalizeDouble(Bid-STEP*Point,Digits);

sellstop = OrderSend(Symbol(),OP_SELLSTOP,Lots,sellstop_OP,10,sellstop_OP+SL*Point,sellstop_OP-TP*Point,NULL,magicsell,0,Red);

}

if ( selllimit < 1 && sells < N && Sell == True)

{

selllimit_OP = NormalizeDouble(Bid+STEP*Point,Digits);

selllimit = OrderSend(Symbol(),OP_SELLLIMIT,Lots,selllimit_OP,100,selllimit_OP+SL*Point,selllimit_OP-TP*Point,NULL,magicsell,0,Blue);

}

M = iTime(Symbol(),1,0);

}

// ---------------------------------------------------------------------

// if the order is further than TS from the price, drag it closer to the price :

if (OrderSelect(buystop,SELECT_BY_TICKET,MODE_TRADES) == true && OrderType() == OP_BUYSTOP && OrderOpenPrice() > Ask + TS*Point)

OrderModify(buystop,Ask + TS*Point,Ask + TS*Point-SL*Point,Ask + TS*Point+TP*Point,0,DeepSkyBlue);

if (OrderSelect(sellstop,SELECT_BY_TICKET,MODE_TRADES) == true && OrderType() == OP_SELLSTOP && OrderOpenPrice() < Bid - TS*Point)

OrderModify(sellstop,Bid - TS*Point,Bid - TS*Point+SL*Point,Bid - TS*Point-TP*Point,0,Orange);

if (OrderSelect(selllimit,SELECT_BY_TICKET,MODE_TRADES) == true && OrderType() == OP_SELLLIMIT && OrderOpenPrice() > Bid + TS*Point)

OrderModify(selllimit,Bid + TS*Point,Bid + TS*Point+SL*Point,Bid + TS*Point-TP*Point,0,DeepSkyBlue);

if (OrderSelect(buylimit,SELECT_BY_TICKET,MODE_TRADES) == true && OrderType() == OP_BUYLIMIT && OrderOpenPrice() < Ask - TS*Point)

OrderModify(buylimit,Ask - TS*Point,Ask - TS*Point-SL*Point,Ask - TS*Point+TP*Point,0,Orange);

// ---------------------------------------------------------------------

// if the order profit is larger than the PROF stop and is further than TS from the price, trawl this stop behind the price:

for(i = 0; i < OrdersTotal(); i ++)

{

OrderSelect(i, SELECT_BY_POS, MODE_TRADES);

if (OrderType() == OP_BUY && (Ask - OrderOpenPrice())/Point > PROF && OrderStopLoss() < NormalizeDouble(Ask - TS*Point,Digits))

OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Ask - TS*Point,Digits),OrderTakeProfit(),0,Blue);

if (OrderType() == OP_SELL && (OrderOpenPrice() - Bid)/Point > PROF && OrderStopLoss() > NormalizeDouble(Bid + TS*Point,Digits))

OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Bid + TS*Point,Digits),OrderTakeProfit(),0,Red)

}

return(0);

}

 

The code should be formatted like this (SRC):

//|                                   iiiiiiiiiiiiiiiii_buy_sell.mq4 |

//|                                                                  |

//|                                                                  |

//+------------------------------------------------------------------+

extern int N = 100;       // баев и сэллов (считаем отдельно) разрешаем по стока штук иметь



extern double Lots = 0.01;  // лот



extern int PROF = 100;    // тралить стоп начнем с профита во стока пипсов

extern int TS = 200;      // тащить его станем на стока сзади пип за ценой

extern int STEP = 200;    // расстояние меджу отложками

extern int TP = 10000;     // тейк ордеров

extern int SL = 10000;     // тейк ордеров

extern bool Buy = false;    // только покупать

extern bool Sell = true;   // только продавать

extern double PROSADKA = 0.5;   // когда эквити равно или менее вот такой части от баланса

extern int magicbuy = 777;

extern int magicsell = 888;



int M;

double buystop_OP, sellstop_OP;

double selllimit_OP, buylimit_OP;



int start()

  {

             // ---------------------------------------------------------------------

         



             // ---------------------------------------------------------------------

             // смотрим, какие ордера у нас есть:

                 int buy = 0,sell = 0;

                 int buystop = 0,sellstop = 0;

                 int selllimit = 0,buylimit = 0;

                 int buys = 0, sells = 0;

                 int Total = 0;

                 for(int i = 0; i < OrdersTotal(); i ++)

                   {

                     OrderSelect(i, SELECT_BY_POS, MODE_TRADES);

                        if(OrderMagicNumber() != magicbuy && OrderMagicNumber() != magicsell) continue;

      

                        

                        

                           if(OrderType() == OP_BUYSTOP)

                              buystop = OrderTicket();

                                

                           if(OrderType() == OP_BUYLIMIT)

                              buylimit = OrderTicket();

                              

                           if(OrderType() == OP_BUYSTOP || OrderType() == OP_BUYLIMIT || OrderType() == OP_BUY)   

                              buys ++;

                           

                           if(OrderType() == OP_SELLSTOP)

                              sellstop = OrderTicket();

                              

                           if(OrderType() == OP_SELLLIMIT)

                              selllimit = OrderTicket();

                              

                            if(OrderType() == OP_SELLSTOP || OrderType() == OP_SELLLIMIT || OrderType() == OP_SELL )

                              sells ++;    

                        

                        Total ++;       

                   }

             

             

           

             // ---------------------------------------------------------------------

                 int LET = 0;

                 if (AccountEquity()/AccountBalance() < PROSADKA)

                    LET = 1;  // если просадки до фига - запрет на выставление новых отложек

           

             // --------------------------------------------------------------------- 

             // выставление отложек :

             if(LET == 0 && TimeCurrent() && M != iTime(Symbol(),1,0)) // раз в минуту

               {   

                 

                 if ( buystop < 1 && buys < N && Buy == true)

                     {

                        buystop_OP = NormalizeDouble(Ask+STEP*Point,Digits);

                        buystop = OrderSend(Symbol(),OP_BUYSTOP,Lots,buystop_OP,10,buystop_OP-SL*Point,buystop_OP+TP*Point,NULL,magicbuy,0,Blue);

                     }

                     

                if ( buylimit < 1 && buys < N && Buy == True)

                     {

                        buylimit_OP = NormalizeDouble(Ask-STEP*Point,Digits);

                        buylimit = OrderSend(Symbol(),OP_BUYLIMIT,Lots,buylimit_OP,100,buylimit_OP-SL*Point,buylimit_OP+TP*Point,NULL,magicbuy,0,Red);     

                     }

                     

                 if ( sellstop < 1 && sells < N && Sell == true)

                     {

                        sellstop_OP = NormalizeDouble(Bid-STEP*Point,Digits);

                        sellstop = OrderSend(Symbol(),OP_SELLSTOP,Lots,sellstop_OP,10,sellstop_OP+SL*Point,sellstop_OP-TP*Point,NULL,magicsell,0,Red);

                     }

                

                if ( selllimit < 1 && sells < N && Sell == True)

                     {

                       selllimit_OP = NormalizeDouble(Bid+STEP*Point,Digits);

                       selllimit = OrderSend(Symbol(),OP_SELLLIMIT,Lots,selllimit_OP,100,selllimit_OP+SL*Point,selllimit_OP-TP*Point,NULL,magicsell,0,Blue);

                     }

                     

                

                

                 M = iTime(Symbol(),1,0);

               }

             

             // --------------------------------------------------------------------- 

             // еси отложки дальше чем TS от цены, подтаскиваем их поближе :

             if (OrderSelect(buystop,SELECT_BY_TICKET,MODE_TRADES) == true && OrderType() == OP_BUYSTOP && OrderOpenPrice() > Ask + TS*Point)

                OrderModify(buystop,Ask + TS*Point,Ask + TS*Point-SL*Point,Ask + TS*Point+TP*Point,0,DeepSkyBlue);

             

             if (OrderSelect(sellstop,SELECT_BY_TICKET,MODE_TRADES) == true && OrderType() == OP_SELLSTOP && OrderOpenPrice() < Bid - TS*Point)

                OrderModify(sellstop,Bid - TS*Point,Bid - TS*Point+SL*Point,Bid - TS*Point-TP*Point,0,Orange);

             

             if (OrderSelect(selllimit,SELECT_BY_TICKET,MODE_TRADES) == true && OrderType() == OP_SELLLIMIT && OrderOpenPrice() > Bid + TS*Point)

                OrderModify(selllimit,Bid + TS*Point,Bid + TS*Point+SL*Point,Bid + TS*Point-TP*Point,0,DeepSkyBlue);

             

             if (OrderSelect(buylimit,SELECT_BY_TICKET,MODE_TRADES) == true && OrderType() == OP_BUYLIMIT && OrderOpenPrice() < Ask - TS*Point)

                OrderModify(buylimit,Ask - TS*Point,Ask - TS*Point-SL*Point,Ask - TS*Point+TP*Point,0,Orange);

            

             // --------------------------------------------------------------------- 

             // еси профит ордера больше PROF  стоп его дальше чем TS от цены, тралим этот стоп за ценой :

             for(i = 0; i < OrdersTotal(); i ++)

                   {

                     OrderSelect(i, SELECT_BY_POS, MODE_TRADES);

                     

                        if (OrderType() == OP_BUY && (Ask - OrderOpenPrice())/Point > PROF && OrderStopLoss() < NormalizeDouble(Ask - TS*Point,Digits))

                           OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Ask - TS*Point,Digits),OrderTakeProfit(),0,Blue);

             

                        if (OrderType() == OP_SELL && (OrderOpenPrice() - Bid)/Point > PROF && OrderStopLoss() > NormalizeDouble(Bid + TS*Point,Digits))

                           OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(Bid + TS*Point,Digits),OrderTakeProfit(),0,Red);

             

                   }

             

          

   return(0);

  }
 
Andrey Vaskin:

To gain experience in this area, I will write 25 EAs for free for your interesting ideas and strategies

Only 19 EAs left

Good afternoon, I wrote in another thread here again.


I have a strategy for binary options. In general its essence is the following: using a movingaverage with a period of 20 I identify the trend, using ADX I define its strength (usually at a visual value over 25 I define it as strong), using graphical analysis I define entry points (usually morning, evening stars, hammers and "hanging fruits", I don't consider doji with symmetrical shadows because I think they are contradictory). By the close of a candle with the required model I enter at 5 o'clock (I checked the statistics manually on 6 months on D1: at best one signal during 6 months. H4 is not considered because of different closing time of the candle geometry at different brokers).

In general on the statistics received by me on the average each tool 0,7-3% for a month (in the transaction was always entered 1% of the deposit) I manually scanned 5 tools (and the broker which I use on options has 42 tools, manually all statistics to work through much work will have to do). I dont take into consideration influence of news on the results. I can later post files from the terminal with my marks on them, where I entered, at what time of expiration I made profit and where I lost etc. My broker uses an MT4 terminal. Maybe somebody has some suggestions how to improve this strategy?

In the description I described the general idea, it would be nice if the Expert Advisor would be able to automatically change the value of the transaction for each period of time (for example once a month).

 
Adelaur:
Sometimes the cursor jumps into the quote field when replying and won't come out of it. How to deal with it:Forum: the cursor jumps into the quote when you reply