[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 193

 

Hint.

#property indicator_separate_window

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{

//---- indicators
ObjectCreate("profit",OBJ_LABEL,0,0,0,0);


//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialisation function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
Print("Profit ", AccountProfit());


string profit ="Profit ="+DoubleToStr(AccountProfit(),2);

ObjectSetText("profit",profit,9, "Tahoma",White);
ObjectSet("profit",OBJPROP_XDISTANCE,3);
ObjectSet("profit",OBJPROP_YDISTANCE,100);

}

how to output it in a separate indicator window, not on the chart itself? tell me ))

 
alderru >> :

So declaring indicator buffers does not mean that the cell values are zero. Right?

Therefore, MathMax is not calculated, as one of the values to be compared (namely, GBPUSD_High) has no value (at all, not even zero).

I see. Thanks OneDepo.

I apologise for confusing everyone with my simplification (pun intended). As I already mentioned, I am not interested in the value of High quotes, I am interested in the maximum value on the bar of my own function, the curve of which the indicator successfully draws and re-recurses while it is forming the bar. This is the range of indicator re-drawing during the bar I was interested in.

I will think about it.

P.S. But why MathMin is considered without problems, the conditions are equal and are declared the same?

P.S. I am very blunt. I cannot do it. Help, please.

Well, let's figure it out.

1. When I said that the values of indicator buffer are unassigned values, i.e. arbitrary values or informational "rubbish", I intentionally frightened you, because it's a "bad idea" to use variables this way, as classics say. Believe me, you will make your life much easier by always initializing all variables you use, regardless of programming language. One of the features of MQL4 is that it initializes local variables by zero by default, and indicator buffers by EMPTY_VALUE. From the help:

EMPTY_VALUE. 0x7FFFFFFFF Default value, pointer to empty value.

Note that this value can be changed with SetIndexEmptyValue(), but in your case it's not essential, so let's leave it at that.


2. If the indicator buffer's value is equal to EMPTY_VALUE, the indicator is not drawn at this point.


3 Let's see what we have now.

GBPUSD_High[i]=MathMax(GBPUSD_High[i],GBPUSD[i]);

EMPTY_VALUE, i.e. approximately 2 to the ninth power is compared to 1.6. What will MathMax() return? Right, it is EMPTY_VALUE that is written to the i-th element of the indicator buffer and according to step 2 will not be drawn.

With the code.

GBPUSD_Low[i]=MathMin(GBPUSD_Low[i],GBPUSD[i]);

Similarly, the difference is that MathMin() will return 1.6. The low buffer will be drawn.

Conclusion. Re-read the highlighted bolt.

Good luck

 
PyMbIH >> :

how to display it in a separate indicator window and not on the chart itself? tell me ))

int init()
   {
   IndicatorShortName("Profit");
   return(0);
   }
int start()
{
//----
if(ObjectFind("прибыль")<0)
   {
   int win_idx=WindowFind("Profit");
   ObjectCreate("прибыль",OBJ_LABEL, win_idx,0,0,0,0);
   }//и т.д.

something like this)

 
OneDepo писал(а) >>

Well, let's sort it out...

Good luck

I've got it all figured out.

I introduced additional variables Max[0] and Min[0] which are compared to and which store intermediate results during bar forming. In their turn, I assigned their values to my indicator variables GBPUSD_High[i] and ...Low[i] . So I didn't have to compare with uninitialized variables :-)

And everything worked!

Thanks a lot OneDepo for the clarification, I've missed it somewhere when reading the tutorial.

 

Can you tell me how to add a stop loss to Ilan1.4?

example:

extern int StopLoss = 50

what should be added ?

ticket=OrderSend(Symbol(),OP_BUYLIMIT,pLots,pLevel,sp,StopLong(pr,sl),TakeLong(pLevel,tp),pComment,pMagic,pExpiration,pColor);

ticket=OrderSend(Symbol(),OP_BUYSTOP,pLots,pLevel,sp,StopLong(pr,sl),TakeLong(pLevel,tp),pComment,pMagic,pExpiration,pColor);

 
tmp.0 >> :
Next question, please :)

Please advise how to make a "set" EA file.

I tried it myself in the tester in the EA properties, then "save", but no way.

HELP!

 
aksol >> :

Please advise how to make a "set" EA file.

Tried it myself in the tester in the EA properties then "save", but no way.

HELP!

So you're doing the right thing.

 
sergeev >> :

So you're doing it right.

I save in the "symbolsets" folder, is that correct or is there another easier way.

>> Thank you.

 

Good afternoon.

Below is the file with the Pattern indicator, I get this error all the time on different TFs

2009.08.20 11:58:49 Cannot open file'C:\Programme\XTB-Trader 4/experts/indicators\MTFPI-sub1.ex4' on the EURUSD,Daily, could someone please check what they need to correct, thanks in advance.
Files:
 
grego писал(а) >>

Good afternoon.

Below is the file with the Pattern indicator, it keeps showing this error on different TFs

2009.08.20 11:58:49 Cannot open file 'C:\Programme\XTB-Trader 4\experts\indicators\MTFPI-sub1.ex4' on the EURUSD,Daily, can someone please check what they need to correct? Thanks in advance.

MTFPI-sub1 indicator is missing.

Reason: