Author: alxrn
0 Views
0 Downloads
0 Favorites
absorption
ÿþ//+------------------------------------------------------------------+

//|                                                   ?>3;>I5=85.mq4 |

//|                                                            alxrn |

//|                                                                  |

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

#property copyright "alxrn"

#property link      ""

#property version   "1.00"

#property strict

extern double size = 50.0;

extern double risk = 5.0;

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

//| Expert initialization function                                   |

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

bool bs,signal;

double s,p1,p2,p3,lot,Profit1,Profit2,Profit3,pred_hi,pred_lo;

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

//|                                                                  |

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

int OnInit()

  {

   return(INIT_SUCCEEDED);

  }

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

//| Expert deinitialization function                                 |

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

void OnDeinit(const int reason)

  {

  }

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

//| Expert tick function                                             |

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

void OnTick()

  {

   if(Signal())

     {

      if(High[1]>High[2] && Low[1]<Low[2] && Close[1]>Open[1] && BarSize() == true)

        {

         SendNotification(">B = " + DoubleToStr(RecomendLot(),2) + "\n"

                          + "0;NB=0O ?0@0 - "  + Symbol() + "\n"

                          + "!B>?>AA = "       + DoubleToStr(Open[1],5) + "\n"

                          + ""59:@>D8B 1/1 = " + DoubleToStr(TakeProfit1_1(),5) + "\n"

                          + ""59:@>D8B 1/2 = " + DoubleToStr(TakeProfit1_2(),5) + "\n"

                          + ""59:@>D8B 1/3 = " + DoubleToStr(TakeProfit1_3(),5));

        }

      else

         if(High[1]>High[2] && Low[1]<Low[2] && Close[1]<Open[1] && BarSize() == true)

           {

            SendNotification(">B = " + DoubleToStr(RecomendLot(),2) + "\n"

                             + "0;NB=0O ?0@0 - "  + Symbol() + "\n"

                             + "!B>?>AA = "       + DoubleToStr(Open[1],5) + "\n"

                             + ""59:@>D8B 1/1 = " + DoubleToStr(TakeProfit1_1(),5) + "\n"

                             + ""59:@>D8B 1/2 = " + DoubleToStr(TakeProfit1_2(),5) + "\n"

                             + ""59:@>D8B 1/3 = " + DoubleToStr(TakeProfit1_3(),5));

           }

     }

  }

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

bool BarSize() // @0AG5B @07<5@0 A25G8 2 >B=>H5=88 7040==>3> ?0@0<5B@0 size 2 ?C=:B0E

  {

   if(Close[1]>Open[1])

     {

      s = NormalizeDouble(Close[1]-Open[1],5)/Point;

     }

   else

      if(Close[1]<Open[1])

        {

         s = NormalizeDouble(Open[1]-Close[1],5)/Point;

        }

   if(s>=size)

     {

      bs = true;

     }

   else

      if(s<size)

        {

         bs = false;

        }

   return(bs);

  }

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

double RecomendLot() // @0AG5B ;>B0

  {

   if(Close[1]>Open[1])

     {

      lot = NormalizeDouble(((AccountFreeMargin()/100)*risk)/(NormalizeDouble(Close[1]-Open[1],5)/Point),2);

     }

   else

      if(Close[1]<Open[1])

        {

         lot = NormalizeDouble(((AccountFreeMargin()/100)*risk)/(NormalizeDouble(Open[1]-Close[1],5)/Point),2);

        }

   return(lot);

  }

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

//|                                                                  |

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

double TakeProfit1_1() // B59:?@>D8B 4;O @8A:0 1 : 1

  {

   if(Close[1]>Open[1])

     {

      p1 = NormalizeDouble(Close[1]-Open[1],5);

      Profit1 = p1+Close[1];

     }

   else

      if(Close[1]<Open[1])

        {

         p1 = NormalizeDouble(Open[1]-Close[1],5);

         Profit1 = Close[1]-p1;

        }

   return(Profit1);

  }

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

//|                                                                  |

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

double TakeProfit1_2() // B59:?@>D8B 4;O @8A:0 1 : 2

  {

   if(Close[1]>Open[1])

     {

      p2 = NormalizeDouble(Close[1]-Open[1],5)*2;

      Profit2 = p2+Close[1];

     }

   else

      if(Close[1]<Open[1])

        {

         p2 = NormalizeDouble(Open[1]-Close[1],5)*2;

         Profit2 = Close[1]-p2;

        }

   return(Profit2);

  }

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

//|                                                                  |

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

double TakeProfit1_3() // B59:?@>D8B 4;O @8A:0 1 : 3

  {

   if(Close[1]>Open[1])

     {

      p3 = NormalizeDouble(Close[1]-Open[1],5)*3;

      Profit3 = p3+Close[1];

     }

   else

      if(Close[1]<Open[1])

        {

         p3 = NormalizeDouble(Open[1]-Close[1],5)*3;

         Profit3 = Close[1]-p3;

        }

   return(Profit3);

  }

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

bool Signal() // >B?@02:0 A>>1I5=8O B>;L:> >48= @07 

  {

   signal = false;

   if(High[1]>High[2] && Low[1]<Low[2] && pred_hi != High[2] && pred_lo != Low[2])

     {

      pred_hi = High[2];

      pred_lo = Low[2];



      signal = true;

     }

   return(signal);

  }

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

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---