Author: Copyright � 2008, Ardiansyah
Orders Execution
It automatically opens orders when conditions are reached
0 Views
0 Downloads
0 Favorites
Ard_Buy
//+------------------------------------------------------------------+
//|                                                      Ard_Buy.mq4 |
//|                                     Copyright © 2008, ARDIANSYAH |
//|                                               ardfx.blogspot.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Ardiansyah"
#property link      "ardfx.blogspot.com"
#property show_inputs
extern int pembagi = 2;

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
   int ticket;
   int err;
   double Margin;
   Margin = AccountFreeMargin( ) ;
   double Hasil;
   double Lots ;
   Hasil = Margin/pembagi/1000;
   Lots = MathFloor(Hasil);
   while(true)
   {
   ticket = OrderSend(Symbol(),OP_BUY,Lots,Ask,0,Ask - 1,0,NULL,0,0,White); 
   if(ticket<0)
       {
        err=GetLastError();
        Print("OrderSend failed with error ",err);
        
        if (err == 135) 
        {
         RefreshRates();
         break;
         }
        }
     else 
     {
     Print("Hasil =", Hasil);
     return(0); 
     }  
      }
   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 ---