Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 536

 

Good afternoon!

There is a problem with the indicator software, the author claims that the indicator is working, but in fact the graph is not displayed - what is the problem?

#property copyright "Copyright © 2006, Profitrader."
#property link      "profitrader@inbox.ru"
//----
#property indicator_separate_window
#property indicator_buffers 1
#property  indicator_color1 Red
//---- input parameters
extern int FastMAPeriod = 3;
extern int SlowMAPeriod = 15;
extern string SecondMarket = "GOLD";
extern bool MarketsDirectCorrelation = true;
//---- buffers
double [];
double Spread[];
double FastEMA[];
double SlowEMA[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string Correlation = "Invert Correlation";
   if(MarketsDirectCorrelation == TRUE) 
       Correlation = "Direct Correlation";
   IndicatorShortName("Will-Spread(" + FastMAPeriod + "," + SlowMAPeriod + 
                      "," + SecondMarket + "," + Correlation + ")");
   IndicatorDigits(Digits + 2);
   IndicatorBuffers(4);
   SetIndexBuffer(0, WillSpread);
   SetIndexBuffer(1, Spread);
   SetIndexBuffer(2, FastEMA);
   SetIndexBuffer(3, SlowEMA);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexLabel(0, "W-S");
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i, counted_bars = IndicatorCounted();
//---- check for possible errors
   if(counted_bars < 0) 
       return(-1);
//---- last counted bar will be recounted
   if(counted_bars > 0) 
       counted_bars--; 
   int limit = Bars - counted_bars;
   if(MarketsDirectCorrelation == TRUE)
     {
       for(i = 0; i < limit; i++)
           Spread[i] = iClose(SecondMarket, 0, i) / Close[i]*100;
     }
   else
     {
       for(i = 0; i < limit; i++)
           Spread[i] = Close[i] / iClose(SecondMarket, 0, i)*100;
     }
   for(i = limit - 1; i >= 0; i--)
     {
       FastEMA[i] = iMAOnArray(Spread, 0, FastMAPeriod, 0, MODE_EMA, i);
       SlowEMA[i] = iMAOnArray(Spread, 0, SlowMAPeriod, 0, MODE_EMA, i);
       WillSpread[i] = FastEMA[i] - SlowEMA[i];
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
AlexMikash:

Good afternoon!

There is a problem with the indicator program, the author claims that the indicator is working, but in fact the graph is not displayed - what is the problem?

The problem is in these lines

   int i, counted_bars = IndicatorCounted();
//---- check for possible errors
   if(counted_bars < 0) 
       return(-1);
//---- last counted bar will be recounted
   if(counted_bars > 0) 
       counted_bars--; 
   int limit = Bars - counted_bars;
The new compiler gives an error when executing, but when compiling it's ok. Have the author run it in the debugger and see the problem immediately.
 
AlexeyVik:

The problem is in these lines

The new compiler gives an error when executing, but when compiling everything is ok. Have the author run it in the debugger and see the problem immediately.


There is no problem, everything works. It's enough to restore the buffer description

//---- buffers
double [];
double Spread[];
double FastEMA[];
double SlowEMA[];

The problem is with the default tool. Most likely there is no GOLD tool, if you put in another tool it's OK


 
What does the yellow signal broadcasting icon in the Metatrader mean? That the signal is temporarily not broadcasting? And why some signals that I can see now in the terminal are not currently listed on mql5.com?
 
Vinin:


No problem, everything works. It is sufficient to restore the buffer description

The problem is with the default tool. Most likely there is no GOLD tool, if you put another tool in, everything is fine.



You see the thing is, I really care about the GOLD tool, how can I hook it up to the terminal?
 
AlexMikash:

You see the thing is, I really care about the GOLD tool, how can I hook it up to the terminal?

Either it is there or it is not. It all depends on the brokerage company. Whether it provides such a tool or not.
 
Vinin:

Either it is there or it is not. It all depends on the DC. Whether it provides such a tool or not.


Thank you, the picture is clear!

 

Good afternoon. I'm learning how to screw indicators into an EA but so far not very successful.

1 - When I run the EA through a tester only when I stop it the indicator labels appear.

2 - I don't understand what are the conditions and how they are written.

I want to ask my EA to trade based on indicator, I just need to know how to attach indicator to my EA.

Based on the arrow indicator which shows up or down BS_Living Now ver #1.mq4 https://www.mql5.com/ru/code/11014#50910

#property



 
 indicator_chart_window //#property indicator_buffers 4 //#property indicator_color1 Red //#property indicator_color2 Yellow //#property indicator_color3 Red //#property indicator_color4 Yellow ////******************// indicator parameter inputextern int BQuant=48; // - number of bars counted //******************// indicator components
                                        // else // { // if(iHigh(NULL,0,t)>=High[iHighest(NULL,0,2,BQuant,t+1)] && // iHigh(NULL,0,t)>iHigh(NULL,0,t-1)) // { // ExtrimHi[t] =iHigh(NULL,0,t); // Break_Detect(t,1);                               //******************// Breakpoint detection } // // if(iLow(NULL,0,t)<=Low[iLowest(NULL,0,1,BQuant,t+1)] && // iLow(NULL,0,t)<iLow(NULL,0,t-1)) // { // ExtrimLo[t] =iLow(NULL,0,t);                                         // Break_Detect(t,-1); //******************// Breakpoint detection } // } // return(0);                                                                 // } //double Break_Detect(int a,int Signal) //***********************************// Determination of breakpoints { // for(int r=1; r<BQuant; r++) // // { // if(Signal==1 && iHigh(NULL,0,a+r)<High[iHighest(NULL,0,2,BQuant,a+r+1)]) // {BreakHi[a] =Low[iLowest(NULL,0,1,r+2,a-1)]; r=BQuant;}               // if(Signal==-1 && iLow(NULL,0,a+r)>Low[iLowest(NULL,0,1,BQuant,a+r+1)]) // {BreakLo[a] =High[iHighest(NULL,0,2,r+2,a-1)]; r=BQuant;}             // } return(0); //  }

Here is my started Expert Advisor
.

extern double Lot=0.1; extern int Magic=0; extern int Stop=98; extern int Take=70; extern int Slip=10; extern int BQuant=48; // - the number of calculated bars int start()
{
double S1=iCustom(NULL, 0, "BS_Living Now",BQuant,0,0);
OrderSend(Symbol(), OP_SELL,Lot, Bid, Slip,Ask+Stop*Point,Ask-Take*Point, "SELL", Magic, 0,Red ); OrderSend(Symbol(), OP_BUY, Lot, Ask, Slip,Bid-Stop*Point,Bid+Take*Point, " BUY", Magic, 0,Blue);

}
 

If you write a simple script which creates an object of type OBJ_ARROW_RIGHT_PRICE and then deletes it, the object is not deleted. Moreover, the ObjectType command suddenly turns out that the created object is not of type OBJ_ARROW_RIGHT_PRICE (==36), but ==22 i.e. a simple "arrow up" !!! Am I the only one who has this or does everyone have this?

There were already opinions of "experts" on this issue: like read the help, or not enough memory :) .

Memory is enough.

It appears that the ObjectCreate command draws an object of the OBJ_ARROW_RIGHT_PRICE type , which cannot be removed by the ObjectsDeleteAll(0,OBJ_ARROW_RIGHT_PRICE) command, but can be removed by the ObjectsDeleteAll(0,22) command, as if we had not the right price tag but an "up arrow". Whose fault ?

#property copyright "Copyright 2014, MetaQuotes Software Corp."

#property link "https://www.mql5.com"

#property version "1.00"

#property strict

//+------------------------------------------------------------------+

//| Script program start function |

//+------------------------------------------------------------------+

void OnStart()

{

Alert(") ;

Alert("obj_arrow_right_price=",OBJ_ARROW_RIGHT_PRICE) ; // ==36

ObjectCreate("MyArrow", OBJ_ARROW_RIGHT_PRICE,0,Time[1],Open[1]) ; //

Alert("objectTipe=", ObjectType("MyArrow") ) ; // ==22 !

ResetLastError() ;

Alert("script delete arrow right price=",ObjectsDeleteAll(0,OBJ_ARROW_RIGHT_PRICE)," lastError=",GetLastError() ) ; // number of deleted objects ==0, errors ==0

}

To delete an object of type OBJ_ARROW_RIGHT_PRICE, use command ObjectsDeleteAll(0,OBJ_ARROW), making sure to specify its subwindow.

p.s. An object of type OBJ_ARROW is "arrow" any, not just "up arrow". ObjectCreate(...OBJ_ARROW...) creates an "up arrow" immediately. So why isn't this in the help?

 
VoDyaMon:

If you write a simple script which creates an object of type OBJ_ARROW_RIGHT_PRICE and then deletes it, the object is not deleted. Moreover, the ObjectType command suddenly turns out that the created object is not of type OBJ_ARROW_RIGHT_PRICE (==36), but ==22 i.e. a simple "arrow up" !!! Am I the only one who has this or does everyone have this?

There were already opinions of "experts" on this issue: like read the help, or not enough memory :) .

Memory is enough.

It appears that the ObjectCreate command draws an object of the OBJ_ARROW_RIGHT_PRICE type , which cannot be removed by the ObjectsDeleteAll(0,OBJ_ARROW_RIGHT_PRICE) command, but can be removed by the ObjectsDeleteAll(0,22) command, as if we had not the right price tag but an "up arrow". Whose fault is it ?

... ... ...

To delete an object of type OBJ_ARROW_RIGHT_PRICE use command ObjectsDeleteAll(0,OBJ_ARROW), with mandatory indication of subwindow.

p.s. An object of type OBJ_ARROW is "arrow" any, not just "up arrow". ObjectCreate(...OBJ_ARROW...) creates an "up arrow" immediately. What's the fuss about why it's not in the help ?

Write in this thread. At least the developers are there.