Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

MQL to JForex questions
 Post subject: MQL to JForex questions Post rating: 0   New post Posted: Fri 14 Aug, 2009, 12:06 

User rating: -
I have a set of questions regarding strategy programming.

1- How to refer to previous bars, you don't seem to use Low[0], Low[1], Low[2], High[1], High[2] .... notation.

2- How can I set the bar time period, I tried setting the Period variable inside and outside the bar without much success. The bar is stuck on 10Sec.

3- How to check if an order has been filled or reached its stop loss. Then triggering another order if this is the case.

4- What is the general rule for referring to indicators inside a strategy.

An example would be preferred.
Thank you.


 
 Post subject: Re: MQL to JForex questions Post rating: 0   New post Posted: Tue 18 Aug, 2009, 12:52 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Hello
1. You need to use IHistory interface to get historical data. Look at the IHistory.getBar() method, it has shift parameter 0 - currently forming candle, 1 - last formed candle etc
2. Depends on what you want to achive. Methods that retrieve historical bars all have period parameter. onBar method is called from the platform and supplied with the correct period for the bars in parameters
3. Filled orders has FILLED state. Look at the IOrder.getState() method. When price reaces some order's stop loss, it gets closed and onMessage method is called with corresponding parameters
4. Indicators can be calculated from IIndicators interface

Examples can be found in Code Examples section of this forum, look at Simple strategy or Limit Order


 

Jump to:  

  © 1998-2024 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com