Coding help - page 680

 
mladen:

Try something like this (all except the corner)

Thank you so much mladen. I hope you are as brilliant at trading as you are at helping traders!

Best regards,

 
thefxpros:

Mladen i can't succeed in make it working. It does not update itself and does not show alerts. Can you help, please?

 

thefxpros

Yo are using shifted values. Arrows for those shifted values will never appear on current or first closed bar - meaning that you can not get alerts if you are testing those two bar values

 
mladen:

Simon

Then you have to check for close conditions the same way as for open conditions

Thanks!
Can I do it like this:
if (OP_BUY && some indicator condition)
{
close (OP_BUY); // Close Buy
return;
}
int doWhat = _doNothing;
      double hull_trend_current  = iCustom(NULL,0,"StepMA pdf 4_6",PERIOD_CURRENT,"",PdfmaLength,SensivityFactor,ConstantStepSize,PdfmaVariance,PdfmaMean,PriceToUse,PdfmaFilter,9,BarToUse);
      double hull_trend_previous = iCustom(NULL,0,"StepMA pdf 4_6",PERIOD_CURRENT,"",PdfmaLength,SensivityFactor,ConstantStepSize,PdfmaVariance,PdfmaMean,PriceToUse,PdfmaFilter,9,BarToUse+1);
      double rsicurrent=iRSI(NULL,0,rsiu,PRICE_CLOSE,0);
      double rsiprevious=iRSI(NULL,0,rsiu,PRICE_CLOSE,1);
      
         if (hull_trend_current==1 && rsiprevious<lowerband&&rsicurrent>=lowerband)
               doWhat = _doBuy;

         if (OP_BUY && some indicator condition) { close (OP_BUY); // Close Buy return; }

         if (hull_trend_current==-1 && rsiprevious>upperband&&rsicurrent<=upperband)
               doWhat = _doSell;
         
         if (doWhat==_doNothing && !DisplayInfo) return(0);
 
simon_json:
Thanks!
Can I do it like this:
I think yes. Did you try it in tests?
 

Hello Mladen ,

Is me again (-.-;)

Now i try to add the ma candle to it, but when i compile it have error "' start' - function already defined and has body ".

I read the doc from mq4 , but i still cant understand .

https://docs.mql4.com/basis/function/events

int OnCalculate is place on before start function or after ?

And is that can have two IndicatorCounted() in same indicator ?

Please help me to check , what  i do wrong .

Thank you .

Files:
 
stevenpun:

Hello Mladen ,

Is me again (-.-;)

Now i try to add the ma candle to it, but when i compile it have error "' start' - function already defined and has body ".

I read the doc from mq4 , but i still cant understand .

https://docs.mql4.com/basis/function/events

int OnCalculate is place on before start function or after ?

And is that can have two IndicatorCounted() in same indicator ?

Please help me to check , what  i do wrong .

Thank you .

You can not have OnCalculate() and start() in the same code (they are the same - the mql compiler translates them to same). Leave just one - the other must either have different name or, the best, if you need it, should be merged with the remaining function
 
mladen:
You can not have OnCalculate() and start() in the same code (they are the same - the mql compiler translates them to same). Leave just one - the other must either have different name or, the best, if you need it, should be merged with the remaining function

ok now i understand , will try to merged it .

Thanks .

 
andreatrade:

Dear mladen,

I've tried both suggestions without succes  but I've realized that the indi does't update when running in a EA as in the following picture.

Should be possible to fix it ?:

Dear mladen,

I found only half of the solution: I have cretated the attached indicator ( Sigma_Andrea_New_1 )where th sima value works also during a backtest but the average not (  the values slould be like the bottom indi - Sigma.mq4- , attached when the EA stopped ). Could you please fix it ?



Files:
 

Hello mr mladen ,

Can you help me to add the ObjectSetFiboDescription to this indicator .

I just want to adding the price on the level (Example:  (61.8) - 234.67).


Thank you .

Files:
QuickFib.mq4  7 kb
 
stevenpun:

Hello mr mladen ,

Can you help me to add the ObjectSetFiboDescription to this indicator .

I just want to adding the price on the level (Example:  (61.8) - 234.67).


Thank you .

stevenpun

Did you try doing it (this is the form of it :

bool  ObjectSetFiboDescription(
   string   object_name,   // object name
   int      index,         // level index
   string   text           // new description
   );

That way you can place it at exact place where you want it. Otherwise I would be guessing what is your intention

Reason: