Forex Forums | ForexLasers.com


Go Back   Forex Lasers Forum > METATRADER FORUM > Expert Advisors / Robots


Need Some mql Help

Expert Advisors / Robots


Reply
 
LinkBack Thread Tools Search this Thread
  #1  
Old 10-01-2019, 22:42
Level 1 Lasers Member
 
Join Date: Jan 2019
Posts: 1
Default Need Some mql Help

i started whit mql and it works all fine, but why he dont open a Buy order? Only sell?

Can you help me? i become crazy^^

PHP Code:

input double Lots 
0.01;

input int TPPoints 500;
input int SLPoints 500;

input int RSIPeriods 14;
input int Top 70;
input int Bottom 30;

input int Magic 1;




int orderTicket 0

int OnInit()
  {

   return(
INIT_SUCCEEDED);
  }

void OnDeinit(const int reason)
  {

   
  }

void OnTick()
{
   
double rsi;
   
double rsi2
   
rsi iRSI(Symbol(), PERIOD_CURRENT,RSIPeriods,PRICE_CLOSE,0);
   
rsi2 iRSI(Symbol(), PERIOD_CURRENT,RSIPeriods,PRICE_CLOSE,0);

      if(
rsi Top
      {     
         if(
OrderSelect(orderTicket,SELECT_BY_TICKET) == true
         {
            if(
OrderType() == OP_BUY
            {
                 
bool res OrderClose(OrderTicket(),OrderLots(),Bid,1000,clrNONE);
                     
orderTicket 0;
                      
            }
         }
         
     if(
orderTicket <= 0
     {
         
orderTicket executShort();
     }
     }
      else if(
rsi2 Bottom
     {
         if(
OrderSelect(orderTicket,SELECT_BY_TICKET) == true
         {
            if(
OrderType() == OP_SELL
            {

                  
bool res OrderClose(OrderTicket(),OrderLots(),Ask,1000,clrNONE);
                     
orderTicket 0;
            }
         }
     }
           
           
     if(
orderTicket <= 0
     {
         
orderTicket executLong();
     }     
}
     
     
     
int executShort () 
   {
      
double entry Bid
      
double tp entry TPPoints Point;
      
double sl entry SLPoints Point;
   
      
int ticket;
      
ticket OrderSend(Symbol(), OP_SELL,Lots,entry,1000,sl,tp,"OP_SELL",Magic,0,clrNONE);
      return 
ticket;
   }

      
int executLong () 
   {
      
double entry Bid;
      
double tp entry TPPoints Point;
      
double sl entry SLPoints Point;
  
      
int ticket;
      
ticket OrderSend(Symbol(), OP_BUY,Lots,entry,1000,sl,tp,"OP_SELL",Magic,0,clrNONE);
      return 
ticket;
   } 
Reply With Quote
  #2  
Old 31-08-2021, 17:35
Level V Lasers Member
 
Join Date: Jun 2015
Posts: 757
Default Re: Need Some mql Help

Sorry, I am not able to help you with this issue as I am just a trader and sometimes I do some freelancing tasks for my client so it better is you can search on Fiverr.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 23:30.


Powered by vBulletin® Version 3.8.10
Copyright ©2000 - 2025, vBulletin Solutions, Inc.