Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

La Modedora de iMA #3

Open
davidjfont opened this issue Feb 13, 2021 · 1 comment
Open

La Modedora de iMA #3

davidjfont opened this issue Feb 13, 2021 · 1 comment
Projects

Comments

@davidjfont
Copy link
Owner

//+------------------------------------------------------------------+
//| _Siempre Positivo v005.mq4 |
//| Copyright 2021, fdfont GDLab |
//| https://www.globaldesign.cloud |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, fdfont GDLab"
#property link "https://www.globaldesign.cloud"
#property version "5.00"
#property strict
input double lots = 0.01;
input int take_profit = 3;
input double stop_loss = 0;
input int magic = 10;
input int Start_Time = 02; // Time to allow trading to start ( hours of 24 hr clock ) 0 for both disables
input int Finish_Time = 21; // Time to stop trading ( hours of 24 hr clock ) 0 for both disables

datetime MomentoUltimaVela = 0;

//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---

//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---

}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
int MAX_ORDERS = 8;
int MAX_ORDERS_BUY = 4;
int MAX_ORDERS_SELL = 4;

     int orders_buy = 0;
     int orders_sell = 0;         
               
               
               for( int i = 0 ; i < OrdersTotal() ; i++ ) { 
                     // We select the order of index i selecting by position and from the pool of market/pending trades.
                     OrderSelect( i, SELECT_BY_POS, MODE_TRADES ); 
                     // If the pair of the order is equal to the pair where the EA is running.
                     if (OrderType() == OP_BUY) {
                     orders_buy++;       
                     
                  
             }
             } 

             for( int i = 0 ; i < OrdersTotal() ; i++ ) { 
                     // We select the order of index i selecting by position and from the pool of market/pending trades.
                     OrderSelect( i, SELECT_BY_POS, MODE_TRADES ); 
                     // If the pair of the order is equal to the pair where the EA is running.
                     if (OrderType() == OP_SELL) {
                     orders_sell++;       
                     
                  
             }
             }                 

     if (MomentoUltimaVela != Time[0]){
     
                          
           if(orders_buy-orders_sell<=MAX_ORDERS_BUY && OrdersTotal()<=MAX_ORDERS && iRSI(Symbol(),0,14,PRICE_MEDIAN,1)<60 && iRSI(Symbol(),0,14,PRICE_MEDIAN,1)>40 && 
           iMA(Symbol(),0,69,1,MODE_LWMA,0,1)>Ask && Finish_Time >Time[0]< Start_Time){
           
                 int compra = OrderSend(Symbol(),OP_BUY,lots,Ask,5,stop_loss,Bid + (MarketInfo(Symbol(),MODE_SPREAD)+1)*Point,"Orden BUY siempre Positivo",magic,0,clrGreen);
                 MomentoUltimaVela = Time[0];
           }
           
            if(orders_sell-orders_buy<=MAX_ORDERS_SELL && OrdersTotal()<=MAX_ORDERS && iRSI(Symbol(),0,14,PRICE_MEDIAN,1)<60 && iRSI(Symbol(),0,14,PRICE_MEDIAN,1)>40 && 
            iMA(Symbol(),0,69,1,MODE_LWMA,0,1)<Bid && Finish_Time >Time[0]< Start_Time){
           
                 int venda = OrderSend(Symbol(),OP_SELL,lots,Bid,5,stop_loss,Bid + (MarketInfo(Symbol(),MODE_SPREAD)-8)*Point,"Orden SELL siempre Positivo",magic,0,clrGreen);
                 MomentoUltimaVela = Time[0];
           }
    }

}
//+------------------------------------------------------------------+

@davidjfont davidjfont added this to iMA JAWS in MTQL4 Feb 13, 2021
@davidjfont
Copy link
Owner Author

//+------------------------------------------------------------------+
//| _Siempre Positivo v005.mq4 |
//| Copyright 2021, fdfont GDLab |
//| https://www.globaldesign.cloud |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, fdfont GDLab"
#property link "https://www.globaldesign.cloud"
#property version "6.00"
#property strict
input double lots = 0.01;
input int take_profit = 3;
input double stop_loss = 0;
input int magic = 10;
input int Start_Time = 01; // Time to allow trading to start ( hours of 24 hr clock ) 0 for both disables
input int Finish_Time = 21; // Time to stop trading ( hours of 24 hr clock ) 0 for both disables

datetime MomentoUltimaVela = 0;

//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---

//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---

}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
int MAX_ORDERS = 8;
int MAX_ORDERS_BUY = 4;
int MAX_ORDERS_SELL = 4;

///////////////////////////////////////////////////////// TRING TO SET THE BUY/SELL TO PAIR…////////
// int orders_buy = 0;
// int orders_sell = 0;
//
//
// for( int i = 0 ; i < OrdersTotal() ; i++ ) {
// // We select the order of index i selecting by position and from the pool of market/pending trades.
// OrderSelect( i, SELECT_BY_POS, MODE_TRADES );
// // If the pair of the order is equal to the pair where the EA is running.
// if (OrderType() == OP_BUY) {
// orders_buy++;
//
//
// }
// }
//
// for( int i = 0 ; i < OrdersTotal() ; i++ ) {
// // We select the order of index i selecting by position and from the pool of market/pending trades.
// OrderSelect( i, SELECT_BY_POS, MODE_TRADES );
// // If the pair of the order is equal to the pair where the EA is running.
// if (OrderType() == OP_SELL) {
// orders_sell++;
//
//
// }
// }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (MomentoUltimaVela != Time[0]){

           if(OrdersTotal()<=MAX_ORDERS-1 && OrdersTotal()<=MAX_ORDERS && iRSI(Symbol(),0,14,PRICE_MEDIAN,1)<60 && iRSI(Symbol(),0,14,PRICE_MEDIAN,1)>40 && 
           iMA(Symbol(),0,69,1,MODE_LWMA,0,1)>Ask){
           
               if(Hour()>Start_Time && Hour()<Finish_Time){
           
                 int compra = OrderSend(Symbol(),OP_BUY,lots,Ask,5,stop_loss,Bid + (MarketInfo(Symbol(),MODE_SPREAD)+1)*Point,"Orden BUY siempre Positivo",magic,0,clrGreen);
                 MomentoUltimaVela = Time[0];
           }
           }
            if(OrdersTotal()<=MAX_ORDERS-1 && OrdersTotal()<=MAX_ORDERS && iRSI(Symbol(),0,14,PRICE_MEDIAN,1)<60 && iRSI(Symbol(),0,14,PRICE_MEDIAN,1)>40 && 
            iMA(Symbol(),0,69,1,MODE_LWMA,0,1)<Bid){
           
            if(Hour()>Start_Time && Hour()<Finish_Time){
                 int venda = OrderSend(Symbol(),OP_SELL,lots,Bid,5,stop_loss,Bid + (MarketInfo(Symbol(),MODE_SPREAD)-8)*Point,"Orden SELL siempre Positivo",magic,0,clrGreen);
                 MomentoUltimaVela = Time[0];
           }
           }
    }

}
//+------------------------------------------------------------------+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
MTQL4
iMA JAWS
Development

No branches or pull requests

1 participant