_Open_BUY_v2

Author:
Orders Execution
It automatically opens orders when conditions are reached
Miscellaneous
It issuies visual alerts to the screen
0 Views
0 Downloads
0 Favorites

Profitability Reports

GBP/CAD Oct 2024 - Jan 2025
0.00 %
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
0.00 %
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
_Open_BUY_v2
//+------------------------------------------------------------------+
//|                                                    _Open_BUY.mq4 |
//|                                           "ÑÊÐÈÏÒÛ ÄËß ËÅÍÈÂÎÃÎ" |
//|              Ñêðèïò îòêðûâàåò BUY íà çàäàâàåìóþ ÷àñòü FreeMargin |
//|                                                                  |
//|                                   Òîëüêî äëÿ ïàð USD... è ...USD |
//|                               (áëàãàäàðþ komposter çà ïîäñêàçêó) |
//|                                                                  |
//|                           Bookkeeper, 2006, yuzefovich@gmail.com |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""
#property show_inputs // Åñëè åñòü æåëàíèå ìåíÿòü ýêñòåðíû â ïðîöåññå
//+------------------------------------------------------------------+
extern int    Interest   = 100;  // Âûäåëèòü ÷àñòü FreeMargin íà ïîçó:
                                 // = 0 îòêðûòü ìèíèìàëüíûì ëîòîì
                                 // = 100 îòêðûòü ñî âñåé äóðè
extern int    DistSL     = 35;   // Ðàññòîÿíèå äî SL
extern int    DistTP     = 35;   // Ðàññòîÿíèå äî TP
extern int    Slippage   = 5;    // Ïðîñêàëüçûâàíèå
extern bool   StopLoss   = true; // Ñòàâèòü èëè íåò
extern bool   TakeProfit = true; // Ñòàâèòü èëè íåò
//+------------------------------------------------------------------+
void start() 
{
int    ticket;
double SL=0,TP=0,Stake,StepDgts,Share,QQ=1.0;
double Step=MarketInfo(Symbol(),MODE_MINLOT);   
int    Dgts=MarketInfo(Symbol(),MODE_DIGITS);     
string FirstPart=StringSubstr(Symbol(), 0, 3 );   
string SecondPart=StringSubstr(Symbol(), 3, 3 );
   Share=0.01*Interest;
   if(SecondPart == "USD") QQ=Ask;
   else
   {
      if(FirstPart != "USD") 
         Alert("OpenBUY: Who is that - "+Symbol()+"? I do not know..."); // :)

   }
   if(AccountFreeMargin()<Step*1000*QQ)
   {
      Alert("Open_BUY: No maney...");
      return;
   }
   if(Share>1.0) Share=1.0; // ×àñòü íå áûâàåò áîëüøå öåëîãî
   if(Share<0) Share=0;    // (???)
   if(Step<0.1) StepDgts=2;
   else
   {
      if(Step<1.0) StepDgts=1;
      else StepDgts=0;
   }
   Stake=NormalizeDouble(AccountFreeMargin()*Share/1000/QQ,StepDgts);
   if(AccountFreeMargin()<Stake*1000*QQ) // Îêðóãëåíèå áûâàåò è ââåðõ
      Stake=NormalizeDouble(Stake-Step,StepDgts); // Òåïåðü ëèøêó íå áóäåò  
   //Åñëè âûäåëåííàÿ ÷àñòü äåïî áóäåò ìåíüøå ìèíèìàëüíî äîïóñòèìîãî ëîòà,
   //ïîçà áóäåò îòêðûòà íà ìèíèìàëüíûé ëîò
   if(Stake<Step) Stake=Step;
   if(StopLoss==true) SL=Bid-DistSL*Point;
   if(TakeProfit==true) TP=Ask+2*DistTP*Point;
   ticket=OrderSend(Symbol(),OP_BUY,Stake,Ask,Slippage,
                    NormalizeDouble(SL,Dgts),
                    NormalizeDouble(TP,Dgts),
                    "",0,0,CLR_NONE);
   if(ticket<=0) Alert("Error Open_SELL: ",GetLastError()); 
   return(0);
}
//+------------------------------------------------------------------+

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