Orders Execution
Checks for the total of open ordersIt automatically opens orders when conditions are reachedIt Closes Orders by itself
0 Views
0 Downloads
0 Favorites
VR---RIF
//=============================================
//Ïî âîïðîñàì çàêàçà ñîâåòíèêîâ îáðàùàòüñÿ íà 
//            ICQ      155553959
//=============================================
extern string ÍÀÑÒÐÎÉÊÈ= "Ãëàâíûå íàñòðîéêè"  ;
extern int    Slip            = 50            ; 
extern int    MagicNumber     = 227           ; 
extern double Lots            = 0.1           ;              
//=============================================
extern int    FastEMA         =15             ;
extern int    SlowEMA         =45             ;
extern int    RSIPeriod       =3              ;
//=============================================
int    t1,t2                                  ;
int start ()                                  {

//=================================================================================
double SID1 = iMA        (NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,0);
double SID2 = iMA        (NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,0);
double RSIS = iRSI       (NULL,0,RSIPeriod, PRICE_CLOSE,        0);                         
//=================================================================================
//ÍÀ×ÀËÎ
//=================================================================================
int siup=0;
int sidw=0;
double pipdiffCurrent=SID1-SID2;
if (pipdiffCurrent>0 && RSIS>50) 
{siup = 1; } 
else 
if (pipdiffCurrent<0 && RSIS<50)
{sidw = 1;  }
//=================================================================================
//=================================================================================
if (OrdersTotal() == 0)
{
        if(siup==1)
        {        
//===============================================================================================================================//
                t1=OrderSend(Symbol(),OP_BUY,Lots,NormalizeDouble(Ask,Digits),Slip,0,0,NULL,MagicNumber,0,CLR_NONE);
        }
        
        if(sidw==1)
        {
                t2=OrderSend(Symbol(),OP_SELL,Lots,NormalizeDouble(Bid,Digits),Slip,0,0,NULL,MagicNumber,0,CLR_NONE);
        }
}

//===============================================================================================================================//
if (OrdersTotal() == 1)
{
        if(siup==1)
        {        
//===============================================================================================================================//
                if(t2>0)
                {
                   OrderClose(t2,Lots,Ask,Slip,Red);
                }
        }
        
        if(sidw==1)
        {
                if(t1>0)
                {
                   OrderClose(t1,Lots,Bid,Slip,Red);
                }
        }
}
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 ---