[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 79

 
Good afternoon, help is needed. There is a certain bar and its closing price. How to implement the following: the owl should open a position when the difference between the current price and the closing price of a certain bar is greater than the set price. I am only able to calculate the difference between the closing price of a given bar and the closing price of the current bar (and not with the price at the moment - which is what I want to achieve).
 
mmero:

Dear Professionals!

Please advise the most correct and fastest method to calculate the overlap of two neighbouring candlesticks.

I suspect the indicators for this have been written for a long time and they are lying here in the database, but I can't find them.

I would do it this way:

double coef;


if(NormalizeDouble(MathMax(High[i],High[i+1])-MathMin(Low[i],Low[i+1]),Digits)==0)  coef = 0;   //обе свечи нулевые и на одном уровне
if(MathMin(High[i],High[i+1])<MathMax(Low[i],Low[i+1]) coef = 0;                                //свечи не перекрываются

else coef = (MathMin(High[i],High[i+1])-MathMax(Low[i],Low[i+1]))/(MathMax(High[i],High[i+1])-MathMin(Low[i],Low[i+1]))
 
tommy27:
Good afternoon, help is needed. There is a certain bar and its closing price. How to implement the following: the owl should open a position when the difference between the current price and the closing price of a certain bar is greater than the set price. I only succeed in calculating the difference between the closing price of a given bar and the closing price of the current bar (and not with the price at the moment - which is what I want to achieve).
use iClose(0,0,0) to get the current Bid price of the current symbol of the current timeframe
 
oDin48:

Guys, could you please tell me the code so that some action is taken after a change by some number of points in some time.

Example. Open Buy if price has changed by 20 pips in 10 minutes.

Be more precise:

1. exactly 20 pips exactly in 10 minutes

2. by no less than 20 pips within last 10 minutes.

3. a change of at least 20 points in the last 10 minutes

...

???

 
alsu:
Use iClose(0,0,0) to get the current Bid price of the current symbol of the current timeframe
Thanks, I did it with Close and as you advised:
StartPrice1 =  iClose(0,0,0);
//StartPrice1 = Close[0];
Delta1 = MathAbs (Price0 - StartPrice1);
Comment (Delta1);
Print ("Raznica= ",Delta1);
But the result is updated only when new bar appears. I want to see and track changes on every tick.
 
alsu:
use iClose(0,0,0) to get the current Bid price of the current symbol of the current timeframe
Is it possible to get the closing price of the current bar iClose(0,0, 0) if it hasn't closed yet? I think the shift should be >0.
 
Can you tell me if it's possible to apply a custom indicator to a custom indicator, how can I do it with standard indicators (selecting to apply to Previous or first indicator`s data)? I've found only standard price constants during the calculation of custom indicators (closing, opening, typical price ...) but I haven't found how to attach a price, not indicator.
 
tommy27:
Good afternoon, need some help. There is a certain bar and its closing price. The implementation of this feature: The owl should open a position if the difference between the current price and the close price of the specified bar is greater than the specified one. I am only able to calculate the difference between the closing price of a given bar and the closing price of the current bar (and not with the price at the moment - which is what I want to achieve).
int bar=1; // заданный бар
int raznica=10; 
if (MathAbs(iClose(0,0,bar)-Bid)>raznica*Point)
   { OrderSend(...)
     ...
   }

But note that you have to put an additional restriction, so that after the execution of this condition the EA will not open a position on every tick...

 
paladin80:
Is it possible to determine the closing price of the current bar iClose(0,0,0) if it hasn't closed yet? I think shift should be >0.

When shift=0, it returns the current price

 
paladin80:
Is it possible to determine the closing price of the current bar iClose(0,0,0) if it hasn't closed yet? I think the shift should be >0.

The closing price of the zero bar is always there, but it changes with the arrival of a new tick.