ADX problems

仕事が完了した

実行時間14 時間
依頼者からのフィードバック
Eric is a great programmer and he helps you to understand code after his work.
開発者からのフィードバック
Great customer, look forward to working with again.

指定

Hi! I have problems with me code. I need somebody help me with that. Thank you

extern double lots = 1;           
extern double CCIsell = 100;
extern double CCIbuy = -100;
extern double CCIclose = 100;
extern double slippage = 0;
extern int CCIperiod = 14;
extern double ADXlimit = 25;
extern int ADX = 14;
extern string nameEA = "B3";
int c, ticket;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
//Variables Initialization//
int positions = 0;  
//Scanning//
for(c = 0; c < OrdersTotal(); c++)
   {       
//Checking open market trades//
    OrderSelect(c, SELECT_BY_POS);
//Looking only for this symbol and orders from this EA//       
      if(OrderSymbol() == Symbol() && OrderType() <= OP_SELL && OrderComment() == nameEA)
        {  
         positions++;
//Checking for close signal for bought trade//
         if(OrderType() == OP_BUY)            
           {
           if(iCCI(NULL, 0, CCIperiod, PRICE_OPEN, 0) >= CCIclose)
             {
              //Close bought trade//
              OrderClose(OrderTicket(), OrderLots(), Bid, slippage, CLR_NONE);  
             } 
           }   
//Checking for close signal for sold trade//
         else
           {
           if(iCCI(NULL, 0, CCIperiod, PRICE_OPEN, 0) <= -CCIclose)
             {
             //Close sold trade//
              OrderClose(OrderTicket(), OrderLots(), Ask, slippage, CLR_NONE);
             }
           }
        }
   }
//If there is no open trade for this pair and this EA//
if(positions < 1)
   {  
      if(AccountFreeMargin() < 1000*lots)
         {
           Print("Not enough money to trade ", lots, " lots. Strategy:", nameEA);
           return(0);
         }
     
   //Checking buy signal//
      if(iCCI(NULL, 0, CCIperiod, PRICE_OPEN, 0) <= CCIbuy)
         { 
              if( (iCCI(NULL, 0, CCIperiod, PRICE_OPEN, 0) < iCCI(NULL, 0, CCIperiod, PRICE_OPEN, 1)) &&
              ( (iADX(NULL, 0, ADX, PRICE_OPEN, MODE_MAIN, 0) >= ADXlimit) || (iADX(NULL, 0, ADX, PRICE_OPEN, MODE_MINUSDI, 0) >= ADXlimit)))
                 
                 //Sell//
                 ticket = OrderSend(Symbol(), OP_SELL, lots, Bid, slippage, 0, 0, nameEA, 0, 0, CLR_NONE);
               
              else
                
                 //Buy//
                 ticket = OrderSend(Symbol(), OP_BUY, lots, Ask, slippage, 0, 0, nameEA, 0, 0, CLR_NONE); 
               
              if(ticket < 0)
              Print("OrderSend(",nameEA,") ERROR #", GetLastError());
               
                                 
         }
      
      //Checking sell signal//
      if(iCCI(NULL, 0, CCIperiod, PRICE_OPEN, 0) >= CCIsell)
         {
              if( (iCCI(NULL, 0, CCIperiod, PRICE_OPEN, 0) > iCCI(NULL, 0, CCIperiod, PRICE_OPEN, 1)) &&
              ( (iADX(NULL, 0, ADX, PRICE_OPEN, MODE_MAIN, 0) >= ADXlimit) || (iADX(NULL, 0, ADX, PRICE_OPEN, MODE_PLUSDI, 0) >= ADXlimit)))
                               
                //Buy//
                ticket = OrderSend(Symbol(), OP_BUY, lots, Ask, slippage, 0, 0, nameEA, 0, 0, CLR_NONE); 
                
            else       
                //Sell//
                ticket = OrderSend(Symbol(), OP_SELL, lots, Bid, slippage, 0, 0, nameEA, 0, 0, CLR_NONE); 
                   
              if(ticket < 0)
               Print("OrderSend(",nameEA,") ERROR #", GetLastError()); 
                    
         }
           
   }   
   return(0);

応答済み

1
開発者 1
評価
(273)
プロジェクト
395
63%
仲裁
70
53% / 26%
期限切れ
198
50%
類似した注文
Hello i need a developer who would be able to create ea that will generate report from history with many different variation, this script should read history from mt4 mt5 and output will be excel file
Looking for a skilled freelancer to create a simple indicator that displays key data directly on the chart during a backtest on MetaTrader 4. The indicator should show: - **Balance** - **Profit in $** - **Profit in %** I already have the sample in MT5 (.mq5 file), but I need it converted and optimized for MT4. This is a straightforward task with a quick turnaround time—just 2 hours. I'm offering $250 for this
Hi, I have a Compiled JForex strategy (.jfx file) I would like someone to convert it in to readable source code. Please let me know if you can do this task. Thank you
I want to make something automatic which EMA will automatically trade in my account. For this I want to make a simple robot I want to get this made automatically on a simple EMA
I need a professional who have the full knowledge in Ctrader and I want to add new idea for my ctrader https://ctrader.com/algos/indicators/show/3444/ Let me know if this is what you can do and the price to get it done. Thanks

プロジェクト情報

予算
10 USD
開発者用
9 - 9 USD
締め切り
最高 1 日