Last CandleSticks

 

Hi Guys,

I am using the MetaTrader APi, i have been looking for an object or a function to get the last finalized candle stick ( the last one before the live one ).

any suggestions ?

Thanks in Advance.

 
 

Hi CB,

Thanks for your reply,

well, i am building a C# .NET application which connect to the MT4 local server,

i used the MetaTrader class but all its functions are related to the current Candlestick being updated simultaniously.

in the library of MEtaTraderAPI, i havent found any other classes that might query the last or few last finalized candlessticks.

in addition i tried to open the *.hst files in C# but unfortunatly i was unable to do that as well, though i am not sure if this is a good idea because i am not sure if these files are updated on the fly and if they wil contain the last finalized candlesticks for current time.

can you help with that ?

Thanks much,

Wasim.

 
WasimFar:

Hi CB,

Thanks for your reply,

well, i am building a C# .NET application which connect to the MT4 local server,

i used the MetaTrader class but all its functions are related to the current Candlestick being updated simultaniously.

in the library of MEtaTraderAPI, i havent found any other classes that might query the last or few last finalized candlessticks.

in addition i tried to open the *.hst files in C# but unfortunatly i was unable to do that as well, though i am not sure if this is a good idea because i am not sure if these files are updated on the fly and if they wil contain the last finalized candlesticks for current time.

can you help with that ?

Thanks much,

Wasim.

Candlesticks are indexed.

0=current

1=previous

2=the one before that

etc


CB

 
cloudbreaker wrote >>

Candlesticks are indexed.

0=current

1=previous

2=the one before that

etc

CB

Hi CB,

i dont know how to get to the Candlesticks the way you describe, can you please put some code and brief explanation ?

Thanks much,

Wasim.

 

High[0] returns the high of the current candlestick.

Open[1] returns the open of the previous candlestick.

etc.

I don't see your problem? Its all well enough explained in the docs.


CB

 
cloudbreaker wrote >>

High[0] returns the high of the current candlestick.

Open[1] returns the open of the previous candlestick.

etc.

I don't see your problem? Its all well enough explained in the docs.

CB

Hi CB,

i am new in this, i tried TZMT4API and i had problem with the connection.

i am trying to use the METATRADERAPI, i looked inside the code for functions and classes and have no documents.

where can i find some documents?

appriciate your help.

Wasim.

 
WasimFar:

Hi CB,

i am new in this, i tried TZMT4API and i had problem with the connection.

i am trying to use the METATRADERAPI, i looked inside the code for functions and classes and have no documents.

where can i find some documents?

appriciate your help.

Wasim.

Look at the first response I sent you at the top of this thread.


(!)


CB

 
WasimFar:

Hi Guys,

I am using the MetaTrader APi, i have been looking for an object or a function to get the last finalized candle stick ( the last one before the live one ).

any suggestions ?

Thanks in Advance.

What are you trying to do? I'm guessing you have chosen the wrong programming start point. It sounds like you are trying to use the API to program, and not MQL4 which is the trading programming language. Did you go to this page and download the API?

https://www.metaquotes.net/en/metatrader4/


If so, then I don't believe this will be helpful for you with what you want to do, unless you actually are running a server locally.


Instead of that, look into one of these methods:

  • Look at this thread on this site and see one of the third party trading APIs for metatrader. 'New API MetaTrader 4 AVAILABLE'. I don't believe they are selling it now, but last time I looked it worked for like ten minutes at a time.
  • Write a C++ wrapper to allow your C# code to interact with MetaTrader. 'Help with crashlog analysis...'
  • If everything else you are doing is already working, then use the DDE features of MetaTrader to access the candle data. http://www.4xlab.net/cs/forums/136/ShowPost.aspx
  • Use MQL4 and program directly within metatrader (but I'm guessing you want to use C#, not mql4)

In each case, you'll be using something similar to what has already been suggested above.



 
jaman wrote >>

What are you trying to do? I'm guessing you have chosen the wrong programming start point. It sounds like you are trying to use the API to program, and not MQL4 which is the trading programming language. Did you go to this page and download the API?

https://www.metaquotes.net/en/metatrader4/

If so, then I don't believe this will be helpful for you with what you want to do, unless you actually are running a server locally.

Instead of that, look into one of these methods:

  • Look at this thread on this site and see one of the third party trading APIs for metatrader. 'New API MetaTrader 4 AVAILABLE'. I don't believe they are selling it now, but last time I looked it worked for like ten minutes at a time.
  • Write a C++ wrapper to allow your C# code to interact with MetaTrader. 'Help with crashlog analysis...'
  • If everything else you are doing is already working, then use the DDE features of MetaTrader to access the candle data. http://www.4xlab.net/cs/forums/136/ShowPost.aspx
  • Use MQL4 and program directly within metatrader (but I'm guessing you want to use C#, not mql4)

In each case, you'll be using something similar to what has already been suggested above.

Thanks Jaman,

you helped much. i am able to run the client. using NDde.dll.

but i still dont know how to get the candles.

can you please put some code how to retrive ? i dont have any classes under NDde.dll that deals with CandleSticks.

 
cloudbreaker wrote >>

Look at the first response I sent you at the top of this thread.

(!)

CB

WasimFar
wrote
>>

Thanks Jaman,

you helped much. i am able to run the client. using NDde.dll.

but i still dont know how to get the candles.

can you please put some code how to retrive ? i dont have any classes under NDde.dll that deals with CandleSticks.

Hi CB,
the documents that you refered are talking about mql4 functions.
the problem that iam writing C# application that has the metatraderapi dll. and there are no such HIGH, LOW, BAR ....
do you have any solution for that ?
Thanks.
Reason: