Tips for getting output from

 

Hello to all friends and professors

I want to get output from this indicator, but I tried everything I knew the code, but I could not get an answer.

Note: The position should be taken at the moment when the indicator signals

I tried these codes to get the output but it is wrong

string Stoch1()
{

  double b1_shift0=iCustom(Symbol(),0,"ISHA Indictor V6.0",3,350,14,1.5,true,false,true,0,0);
  double b1_shift1=iCustom(Symbol(),0,"ISHA Indictor V6.0",3,350,14,1.5,true,false,true,1,0);
  double b2_shift0=iCustom(Symbol(),0,"ISHA Indictor V6.0",3,350,14,1.5,true,false,true,0,1);
  double b2_shift1=iCustom(Symbol(),0,"ISHA Indictor V6.0",3,350,14,1.5,true,false,true,1,1);
  
Comment(b1_shift0,"\n",b1_shift1,"\n",b2_shift0);
  
if(b1_shift1>=0)
return("buy");

//else

if(b1_shift1<b2_shift1)
return("sell");

return "no signal";
}
    
Files:
 
  double b1_shift0=iCustom(Symbol(),0,"ISHA Indictor V6.0",3,350,14,1.5,true,false,true,0,0);
  double b1_shift1=iCustom(Symbol(),0,"ISHA Indictor V6.0",3,350,14,1.5,true,false,true,1,0);
  double b2_shift0=iCustom(Symbol(),0,"ISHA Indictor V6.0",3,350,14,1.5,true,false,true,0,1);
  double b2_shift1=iCustom(Symbol(),0,"ISHA Indictor V6.0",3,350,14,1.5,true,false,true,1,1);

Get your shifts and buffer indexes correct.

 
Keith Watford:

Get your shifts and buffer indexes correct.

Hi, thank you

I changed all these things but could not get the signal

Files:
isha_php.jpg  138 kb
 
Naqibjan:

Hi, thank you

I changed all these things but could not get the signal

Show your revised code.

 
Keith Watford:

Show your revised code.

Thank you for your attention

//+------------------------------------------------------------------+
//|                                                                  |
//|                                                                  |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+

extern int Magic1=1;

extern int Magic2=2;

extern double  timeclose1=100;

extern bool usetrail=true;
extern double risk=1;
extern int accuracy=2;

extern double lot=0.1;

extern int slippage=6;

extern int stoploss=5000;

extern int takeprofit=2000;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {

if(Volume[0]<=1)
{

   if(Stoch1()=="buy")


 {
 close2(Magic2);
 if(Orders1()==115)
  Pendbuy();

  }
  if(Stoch1()=="sell")

 {
 close2(Magic1);
   if(Orders1()==115)
  Pendsell();

  }
    
     } 
     return(0);
  }
//+------------------------------------------------------------------+
int Orders1()
{
int num=115;

 for(int i=OrdersTotal()-1;i>=115;i--)
 {
 OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
 
 if(OrderMagicNumber()==Magic1 || OrderMagicNumber()==Magic2)
  
  num++;
  
  }
return(num);
}
//---------------------------------------------------------------------
void Pendbuy()
{
OrderSend(Symbol(),OP_BUY,lot,Ask,slippage,Ask-stoploss*Point(),Ask+takeprofit*MathPow(10,-Digits),"Ghobar",Magic1,0,Blue);

}
//---------------------------------------------------------------------
void Pendsell()
{
OrderSend(Symbol(),OP_SELL,lot,Bid,slippage,Bid+stoploss*Point(),Bid-takeprofit*MathPow(10,-Digits),"Ghobar",Magic2,0,Red);
}
//+------------------------------------------------------------------+
string Stoch1()
{
  double b1_shift0=iCustom(Symbol(),0,"ISHA Indictor V6.0",3,350,14,1.5,true,false,true,0,0);
  double b1_shift1=iCustom(Symbol(),0,"ISHA Indictor V6.0",3,350,14,1.5,true,false,true,1,0);
  double b2_shift0=iCustom(Symbol(),0,"ISHA Indictor V6.0",3,350,14,1.5,true,false,true,0,1);
  double b2_shift1=iCustom(Symbol(),0,"ISHA Indictor V6.0",3,350,14,1.5,true,false,true,1,1);
  
Comment(b1_shift0,"\n",b1_shift1,"\n",b2_shift0);
  
if(b1_shift1>=0)
return("buy");

//else

if(b1_shift1<b2_shift0)
return("sell");

}
                                                                |
//+------------------------------------------------------------------+
void close2(int number)
  {
   double totalProfit = totalProfit(number);

   if(totalProfit > 0)
     {
      for(int i = OrdersTotal() - 1; i >= 0; i--)
        {
         if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) && OrderSymbol() == Symbol() && OrderMagicNumber() == number && OrderType()<=OP_SELL)
            bool result=OrderClose(OrderTicket(), OrderLots(), Ask,slippage, Yellow);
            
            if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) && OrderSymbol() == Symbol() && OrderMagicNumber() == number && OrderType()<=OP_BUY)
            OrderClose(OrderTicket(),OrderLots(),Bid,slippage,Green);
           
           }
     }
  }

//+------------------------------------------------------------------+
//|                                                                    |
//+------------------------------------------------------------------+
double totalProfit(int number)
  {
   double totalProfit = 0;

   for(int i = OrdersTotal() - 1; i >= 0; i--)
     {
      if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) && OrderSymbol() == Symbol() && OrderMagicNumber() == number)
         totalProfit += (OrderProfit() + OrderCommission() + OrderSwap());
     }

   return totalProfit;
  }
 
  double b1_shift0=iCustom(Symbol(),0,"ISHA Indictor V6.0",3,350,14,1.5,true,false,true,0,0);
  double b1_shift1=iCustom(Symbol(),0,"ISHA Indictor V6.0",3,350,14,1.5,true,false,true,1,0);
  double b2_shift0=iCustom(Symbol(),0,"ISHA Indictor V6.0",3,350,14,1.5,true,false,true,0,1);
  double b2_shift1=iCustom(Symbol(),0,"ISHA Indictor V6.0",3,350,14,1.5,true,false,true,1,1);

Read the documentation on iCustom carefully.

Seems to me that you are reversing the shift and buffer index.

 
Keith Watford:

Read the documentation on iCustom carefully.

Seems to me that you are reversing the shift and buffer index.

I tried everything I knew


if(b1_shift0<b1_shift1)
if(b1_shift1<b2_shift0)
if(b1_shift1<b2_shift1)

ّFor sell.

 
Naqibjan: I tried everything I knew

Except reading the documentation and making your variable names match the corresponding call. Keith has told you twice.

 
Naqibjan:

Hello to all friends and professors

I want to get output from this indicator, but I tried everything I knew the code, but I could not get an answer.

Note: The position should be taken at the moment when the indicator signals

I tried these codes to get the output but it is wrong

Very Simple

         double Buy =iCustom(Symbol(),0,"ISHA_Indictor_V6.0",0,2);
         double Sell=iCustom(Symbol(),0,"ISHA_Indictor_V6.0",1,2);
         if(Buy!=2147483647 && Buy>0) Print("Buy Orders..");
         if(Sell!=2147483647 && Sell>0) Print("Sell Orders..");
         
 
William Roeder:

Except reading the documentation and making your variable names match the corresponding call. Keith has told you twice.

I thank all my friends

Yes, Mr. Keith said, but I could not do everything I tried.

 
Mehmet Bastem:

Very Simple

Thanks for the tips

I tried the code you said but it does not work correctly

At the beginning of each candle, 1 buying position opens

Files:
5050.jpg  381 kb
Reason: