Go Back   DailyFX Forex Forum | FX Forum > FXCM Products and Services > FXProgrammers > Discussion / Support Forum > Indicator SDK Support

Reply
 
Thread Tools Rate Thread
  #1 (permalink)  
Old 04-17-2009, 11:18 AM
Registered User
 
Join Date: Feb 2009
Posts: 2
cmbq is on a distinguished road
How to get the barSize and pair's name

In my indicator, I try to get the instance's barSize i.e. H1, D1, m5 etc. I used bar_stream.barSize(). But it doesn't work, nil value.
What code should I use ? Maybe something like source.bar_stream.barSize().

How can I get pair's name, i.e. EUR/USD, GBP/USD

Thanks
Reply With Quote
  #2 (permalink)  
Old 04-17-2009, 03:25 PM
Member
 
Join Date: Oct 2008
Posts: 609
Nikolay.Gekht is on a distinguished road
1) Bar size

Please, use instance.source:barSize() to get the size of the bar. This can be used in the Prepare and Update methods only. Pay attention, in the lua language the method name is separated from the object name with a colon. The dot is used to access the object properties.

Ensure that your indicator declares "bars" as a required source (indicator:requiredSource(core.Bar); in the Init).

2) Instrument name

There is no way to get instrument name directly. You can use the name of the stream. In Marketscope the first letters will contain the instrument name. There is not reason to provide the instrument since indicator can be applied on the results of other indicator as well as to the prices.
Reply With Quote
  #3 (permalink)  
Old 04-19-2009, 12:31 AM
Registered User
 
Join Date: Feb 2009
Posts: 2
cmbq is on a distinguished road
Thanks

Thanks for the answer.

My indicator bases on the MVA, so I think I can't use barSize function.

Thanks
Reply With Quote
  #4 (permalink)  
Old 04-21-2009, 10:00 AM
Member
 
Join Date: Oct 2008
Posts: 609
Nikolay.Gekht is on a distinguished road
If you need it, you can declare you indicator as bar-based, and implement your own choice of the open, high, low or close bar as a parameter of your indicator. I can give you an example if you wish, but I will be able to do it in a few days.
Reply With Quote
  #5 (permalink)  
Old 04-23-2009, 11:31 PM
Member
 
Join Date: Apr 2009
Posts: 8
yantz is an unknown quantity at this point
hi Nikolay! can you give an exact example of how to extract the instrument name from the stream. i'm struggling with all these classes. thank you

yantz
Reply With Quote
  #6 (permalink)  
Old 04-24-2009, 03:14 PM
Member
 
Join Date: Apr 2009
Posts: 8
yantz is an unknown quantity at this point
i ended up writing my own indicators via order2go GetPriceHistory. thx all for looking!

yantz
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Disclaimer: Trading foreign exchange on margin carries a high level of risk, and may not be suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to trade foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with foreign exchange trading, and seek advice from an independent financial advisor if you have any doubts. Any opinions, news, research, analyses, prices, or other information contained on this website is provided as general market commentary and does not constitute investment advice. Forex Capital Markets LLC. will not accept liability for any loss or damage, including without limitation to, any loss of profit, which may arise directly or indirectly from use of or reliance on such information.

All times are GMT -5. The time now is 09:06 AM.
Copyright ©2009 Daily FX. All Rights Reserved.