How can I declare the current price and time?

 

Hello,

I'd like to programm the following simple strategy:

If the current bars price is higher than the (current bars open + the 80% of the current bars range) in the last 1 min of the bars period (H1) the program should buy..

So i want something like this:

if ("current price" > Open[0]+(High[0]-Low[0])*0.8 && TimeCurrent >= Time[0]+ "59min")

{

OrderSend(Symbol(),OP_BUY,1,Ask,0,0,0);

}

So I dont know how to declare the current price and the "last 1 min".

Thanks,

David

 
MarketInfo(Symbol(), MODE_BID) or Close[0] or iClose()
 
qjol:
MarketInfo(Symbol(), MODE_BID) or Close[0] or iClose()


Or Bid.

For the time use . . . .

if( . . .  . .  && TimeCurrent()%(PERIOD_H1 * 60) >= 59 * 60)
 
Gotthenut122:

Hello,

I'd like to programm the following simple strategy:

If the current bars price is higher than the (current bars open + the 80% of the current bars range) in the last 1 min of the bars period (H1) the program should buy..

So i want something like this:

if ("current price" > Open[0]+(High[0]-Low[0])*0.8 && TimeCurrent >= Time[0]+ "59min")

...

Because you want to open position BUY use Ask as a current price:

if (Ask > (Open[0]+ (High[0]-Low[0])*0.8 ) && TimeCurrent() >= (Time[0]+59*60) )
 

Thanks paladin80 that worked!

And for sure thanks for the other answers!

Reason: