ObjectCreate and other API questions

How to create strategies and indicators
Message
Author
render8556
Posts: 6
Joined: Tue Mar 19, 2013 3:35 am

ObjectCreate and other API questions

#1 Postby render8556 » Tue Mar 19, 2013 3:50 am

Hello, I recently purchased FT and am having fun porting some of my mt code to pascal.. Just had a few quick questions/issues..

1. In my project there are multiple charts for one currency open, each set to a different timeframe. When i run the following, the objects get created on all the timeframes for the pair. By calling SetCurrencyAndTimeframe i was expecting the objects only in the timeframe specified? Is there anything else that should be done?

Code: Select all

     SetCurrencyAndTimeframe('EURJPY', 1);

     ObjectCreate(TOP_LINE, obj_HLine, 0, Time(0), Close(0));
     ObjectCreate(TOPFAR_LINE, obj_HLine, 0, Time(0), Close(0));
     ObjectCreate(BOTTOM_LINE, obj_HLine, 0, Time(0), Close(0));
     ObjectCreate(BOTTOMFAR_LINE, obj_HLine, 0, Time(0), Close(0)); 


This also seems the case for when calling SetCurrency.. in GetSingleTick.. specifying a specific timeframe is ignored and the processing run on all timeframe charts for a pair.

2. Is there any way to access which timeframe a tick has come from in GetSingleTick? Or anywhere in the api at all? Or is GetSingleTick only called once per pair per tick?

3. Are there any easy way's to have a new compiled dll register in FT without reinstalling and overriding the dll from the file menu?

4. Similarly, is there any way to get the InitStrategy procedure to get called without reinstalling the strategy!?

Thanks in advance for any advice.

EDIT: My brain just clicked and created indicators instead of strategies as they should be.. which leads to question 6..

6. Is it just for me that ObjectCreate fails in the Init method for an indicator? To make them work i had to call it from calculate. Any background to that most welcome.

FT Support
Posts: 905
Joined: Sat Jul 11, 2009 10:54 am

#2 Postby FT Support » Tue Mar 19, 2013 11:19 am

Hello,

Thank you for your questions. Please see our comments below:

1. For now there is no way to set specific timeframes from code.

2. tick comes to the whole currency but not to the specific chart or timeframe.

3. you can just replace dll in Strategies folder but this dll can be used by the program so the best way to replace the strategy is to use "File -> install" menu.

4. you can disable the strategy and then enable it again to call InitStrategy procedure.

6. ObjectCreate cannot be used in Init procedure.
Check our other product here:
http://www.forexcopier.com

render8556
Posts: 6
Joined: Tue Mar 19, 2013 3:35 am

#3 Postby render8556 » Tue Mar 19, 2013 10:31 pm

Thanks very much for confirming my experiences with the API.

In the end i was able to achieve what I needed to porting my metatrader code over. Apart from the language difference there was very little that changed.

As future ideas, exposing the timeframes and chart details (chat min/max etc) also would be great.


Return to “FT API”

Who is online

Users browsing this forum: No registered users and 29 guests