Buy with open price of previous day candle

 

Hello forum, good day.

I'm new to MQL5 programming language, I come from a Web Development context and would like to start trading with MetaTrader 5. I started reading Step-By-Step Guide to writing and Expert Advisor in MQL5 for Beginners, the MQL5 Docs and a book (Expert Advisor Programming for Metatrader 5) just a few days ago. I've learned that in order to place a Buy Order, +DI must be greater than -DI and have to look for black candles, and to place a Sell Order +DI must be lower than -DI and look for white candles.  

I was wondering how to find a black or white candle after this condition is met (+DI > -DI or +DI < -DI), and then place an order. Something else I would like to know is, once I find this specific candle, can I get the Open, High and Low price values from the previous candle? I think that this would be a Pending Order because I won't use the price of every tick, is this correct?

Regards and thank you in advance. 

 
codeMolecules:

Hello forum, good day.

I'm new to MQL5 programming language, I come from a Web Development context and would like to start trading with MetaTrader 5. I started reading Step-By-Step Guide to writing and Expert Advisor in MQL5 for Beginners, the MQL5 Docs and a book (Expert Advisor Programming for Metatrader 5) just a few days ago. I've learned that in order to place a Buy Order, +DI must be greater than -DI and have to look for black candles, and to place a Sell Order +DI must be lower than -DI and look for white candles.  

I was wondering how to find a black or white candle after this condition is met (+DI > -DI or +DI < -DI), and then place an order. Something else I would like to know is, once I find this specific candle, can I get the Open, High and Low price values from the previous candle? I think that this would be a Pending Order because I won't use the price of every tick, is this correct?

Regards and thank you in advance. 

Hello codeMolecules,

take a look at the CopyRates function together with the timeframe PERIOD_D1.

Using the abovementioned function together with the correct timeframe, you can easily get the previous day OHLC parameters.

Regards,
Malacarne 

 
Malacarne:

Hello codeMolecules,

take a look at the CopyRates function together with the timeframe PERIOD_D1.

Using the abovementioned function together with the correct timeframe, you can easily get the previous day OHLC parameters.

Regards,
Malacarne 

Hi Malacarne,

Thanks for your response, I'll check them out to do some tests with an Expert Advisor.

Regards,

codeMolecules 

Reason: