Author: Crazy
Price Data Components
Series array that contains the highest prices of each barSeries array that contains the lowest prices of each barSeries array that contains open prices of each barSeries array that contains close prices for each bar
Orders Execution
Checks for the total of open ordersIt can change open orders parameters, due to possible stepping strategyIt automatically opens orders when conditions are reached
0 Views
0 Downloads
0 Favorites

Profitability Reports

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%
NZD/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%
Alex
//+------------------------------------------------------------------+
//|                                                          666.mq4 |
//|                                                           Crazy  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Crazy "
#property link      ""

//---- input parameters
//---- input parameters
extern double TakeProfit = 50;
extern double Lots = 0.1;
extern double StopLoss = 11;
extern double FreeMargin = 2500;
extern double MathLots = 900;
extern double ModStop = 25;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {

  
 
  int cnt, ticket, total,TotalOpenOrders,Commentary;
  int napr;

      double high1  = iHigh(NULL,0,1); //Âåðõíÿÿ öåíà ïðîøëîãî ïåðèîäà
      double low1   = iLow(NULL,0,1);  //Íèæíÿÿ öåíà ïðîøëîãî ïåðèîäà
      double open1  = iOpen(NULL,0,1); //Öåíà îòêðûòèÿ ïðîøëîãî ïåðèîäà
      double close1 = iClose(NULL,0,1);//Âåðõíÿÿ çàêðûòèÿ ïðîøëîãî ïåðèîäà
      
      double high2  = iHigh(NULL,0,2); //Âåðõíÿÿ öåíà ïîçàïðîøëîãî ïåðèîäà
      double low2   = iLow(NULL,0,2);  //Íèæíÿÿ öåíà ïîçàïðîøëîãî ïåðèîäà
      double open2  = iOpen(NULL,0,2); //Öåíà îòêðûòèÿ ïîçàïðîøëîãî ïåðèîäà
      double close2 = iClose(NULL,0,2);//Âåðõíÿÿ çàêðûòèÿ ïîçàïðîøëîãî ïåðèîäà

    if  (open1>close1)napr = 1;
      else napr = 0;
  

 
 //Comment(high1,"\n",low1,"\n",open1,"\n",close1);
 
 
//----
   // ñ÷èòàåì êîëâî îòêðûòûõ îðäåðîâ    

total=OrdersTotal();
TotalOpenOrders = 0;
for(cnt=0;cnt<total;cnt++)
{
   if (OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES) == true) 
      {
      if (OrderSymbol()==Symbol())
         {
         TotalOpenOrders = TotalOpenOrders+1;
         if (OrderType( ) == 0)
              { 
              //Comment("Ñòîèò Áàé");
              //Comment(OrderTakeProfit(),"|",Bid,"|", OrderTakeProfit()-Bid);
                if ((OrderTakeProfit()-Bid)<=ModStop*Point)
                {
                          OrderModify(OrderTicket(),OrderOpenPrice(),Bid-StopLoss*Point,Bid+TakeProfit*Point,0,CLR_NONE);
                 
                 }
                 }
       else
       {
             
            // Comment(OrderTakeProfit(),"|",Ask,"|", Ask-OrderTakeProfit());

            if ((Ask-OrderTakeProfit())<=ModStop*Point) 
                    {
                           OrderModify(OrderTicket(),OrderOpenPrice(),Ask+StopLoss*Point,Ask-TakeProfit*Point,0,CLR_NONE);
                     //Comment("Èçìåíèòü");
                    //  Comment("Ñòîèò Ñåëë");
                       }
         }       
         }//ÊîíåöÅñëè ýòîò ñèìâîë
     }//ÊîíåöÅñëè âûáðàí
    
}//ÊîíåöÖèêëà



if (TotalOpenOrders < 1)
{
/*
  if (AccountEquity()< FreeMargin)
{
Lots = 0.1;
}
else  Lots = (MathRound( AccountEquity()/MathLots)/ 10);
*/
   
    if (napr == 0)
    {
      OrderSend(Symbol(), OP_SELL,Lots,Bid,3,Bid+StopLoss*Point,Bid-TakeProfit*Point,NULL,0,0,CLR_NONE);
    }
    if (napr == 1)
    {
      OrderSend(Symbol(), OP_BUY,Lots,Ask,3,Ask-StopLoss*Point,Ask+TakeProfit*Point,NULL,0,0,CLR_NONE);
    }
}
   
//----
   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 ---