| View previous topic :: View next topic |
| Author |
Message |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
Posted: Sun Mar 25, 2007 8:22 pm Post subject: Released Strategies API for Microsoft Visual C++ |
|
|
Now Strategies API available not only for Borland Delphi but for Microsoft Visual C++ also. Below you can find attached API files with examples and documentation.
| Description: |
|
 Download |
| Filename: |
StrategiesHelp.zip |
| Filesize: |
82.29 KB |
| Downloaded: |
1023 Time(s) |
| Description: |
| API files with strategy example |
|
 Download |
| Filename: |
api+example.zip |
| Filesize: |
30.18 KB |
| Downloaded: |
976 Time(s) |
_________________ Hasta la vista
Mike |
|
| Back to top |
|
 |
pion
Joined: 19 Mar 2007 Posts: 1
|
Posted: Thu Mar 29, 2007 12:51 am Post subject: |
|
|
Hi Terranin,
what is the latest C++ API header file: IndicatorInterfaceUnit.h? I found some version inside: http://forextester.ru/forum/download.php?id=19
have you released formal Indicator API??
Thanks
|
|
| Back to top |
|
 |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
Posted: Thu Mar 29, 2007 1:47 am Post subject: |
|
|
No, it was an old effort to translate indicators' API. It is not ready yet.
_________________ Hasta la vista
Mike |
|
| Back to top |
|
 |
Tantalus

Joined: 23 Mar 2007 Posts: 300
|
Posted: Fri Mar 30, 2007 8:55 pm Post subject: |
|
|
Can this API be used to create plain indicators, too? I know a little C, so I think it might be easier for me than learning Delphi, which is based on Pascal.
If so, where might I find instructions and examples for writing indicators in C?
|
|
| Back to top |
|
 |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
Posted: Fri Mar 30, 2007 9:26 pm Post subject: |
|
|
| Tantalus wrote: | Can this API be used to create plain indicators, too? I know a little C, so I think it might be easier for me than learning Delphi, which is based on Pascal.
If so, where might I find instructions and examples for writing indicators in C? |
Indicators' C++ API will be available soon.
_________________ Hasta la vista
Mike |
|
| Back to top |
|
 |
patronus
Joined: 15 Apr 2008 Posts: 8 Location: Sacramento CA
|
Posted: Tue Apr 15, 2008 9:39 pm Post subject: Indicator Code Supplied is in Delphi! |
|
|
Will similar code be released in C++ for these indicators? Do you have any sample C++ indicators I could use to model mine? I'm specifically looking to create a Momentum-ZL which is a relatively small change to the basic Momentum indicator.
Any help would be appreciated.
Thanks...
|
|
| Back to top |
|
 |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
Posted: Tue Apr 15, 2008 10:41 pm Post subject: Re: Indicator Code Supplied is in Delphi! |
|
|
| patronus wrote: | Will similar code be released in C++ for these indicators? Do you have any sample C++ indicators I could use to model mine? I'm specifically looking to create a Momentum-ZL which is a relatively small change to the basic Momentum indicator.
Any help would be appreciated.
Thanks... |
There is already API available for C++, you can find it after installation in ForexTester\Examples\ folder. There is one strategy example and one indicator (Ishimoku) example.
_________________ Hasta la vista
Mike |
|
| Back to top |
|
 |
FinGeR
Joined: 23 Apr 2008 Posts: 72
|
|
| Back to top |
|
 |
frank_horrigan

Joined: 16 Jan 2010 Posts: 7 Location: Pribram, Czech Rep.
|
Posted: Sat Jan 16, 2010 1:13 pm Post subject: Sample of C API strategy |
|
|
Hello Mike and others,
can you anyone provide me some simple strategy written by C++ API, which I can use to learn how to write my own ideas When I viewed the headers, function prototypes and definitions (StrategyInterfaceUnit) it apperar as very similar to MQL, with that I wrote (and live running) some strategies. But, the MQL and Metatrader has limitations which is bad for me (no Multipair trades on one EA), total absention of constants and structures (when I need function return more than one variable, what I can do? (other than wrote some structure and this return?).
So, if you have some usable and "learnable how it works" strategy, can you email (or PM) me its code?? (I using in entry decision CCI, Envelopes and EMA, if the code would contains how use this, i will be great)
Last question: Can I mount the DLL to metatrader's EA and run it at live account? If is possibe, how to do? (I'm going to definitively leave the MQL, if it is possible, this will be great way)
_________________ The Market can stay irrational longer than you can stay solvent |
|
| Back to top |
|
 |
frank_horrigan

Joined: 16 Jan 2010 Posts: 7 Location: Pribram, Czech Rep.
|
Posted: Sat Jan 16, 2010 1:30 pm Post subject: Re: Indicator Code Supplied is in Delphi! |
|
|
| Terranin wrote: |
There is already API available for C++, you can find it after installation in ForexTester\Examples\ folder. There is one strategy example and one indicator (Ishimoku) example. |
In quoted directory I have not anything usable, only headers which contains definitions and prototypes, an one .CPP file which tells some about object create/set/modify/delete routines. If I had example, I'll not ask you for it, of course Indicator example (ichomuko kinko hyo I have, but this is useless for me )
_________________ The Market can stay irrational longer than you can stay solvent |
|
| Back to top |
|
 |
frank_horrigan

Joined: 16 Jan 2010 Posts: 7 Location: Pribram, Czech Rep.
|
Posted: Sat Jan 16, 2010 6:28 pm Post subject: |
|
|
So, I had success with coding "extern" variables and similar stuff, as explained in the "programming lessons" In addition, I was understood how to use send/modify/delete orders, is wrote in similar analogy as MQL. But, and with it I cannot solve: How I can use the Time functions? (is sufficient "relative", so as in MQL Hour(), Minute() and Second() - I drive enter to position in the "entry if" as if( condition && condition &&.......&& Minute() ==0 && BARS != Bars) where assigment BARS=Bars is called when OrderSend(...) returns non-zero integer (ticket num) -so entry condition remains on Minute() ==0 - how I can write it by FT C++ API??
Another question: How I may use built-in indicators, as is CCI, RSI, MA, Stoch, and so on?? In MQL analogy, they I call as iCCI(Currency, TF, Period, UsedPriceToCalculation, shift). Any ideas and/or solutions?
_________________ The Market can stay irrational longer than you can stay solvent |
|
| Back to top |
|
 |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
Posted: Sat Jan 16, 2010 7:16 pm Post subject: |
|
|
| frank_horrigan wrote: | So, I had success with coding "extern" variables and similar stuff, as explained in the "programming lessons" In addition, I was understood how to use send/modify/delete orders, is wrote in similar analogy as MQL. But, and with it I cannot solve: How I can use the Time functions? (is sufficient "relative", so as in MQL Hour(), Minute() and Second() - I drive enter to position in the "entry if" as if( condition && condition &&.......&& Minute() ==0 && BARS != Bars) where assigment BARS=Bars is called when OrderSend(...) returns non-zero integer (ticket num) -so entry condition remains on Minute() ==0 - how I can write it by FT C++ API??
Another question: How I may use built-in indicators, as is CCI, RSI, MA, Stoch, and so on?? In MQL analogy, they I call as iCCI(Currency, TF, Period, UsedPriceToCalculation, shift). Any ideas and/or solutions? |
Check this topic how to work with time http://www.forextester.com/forum/viewtopic.php?t=1000&highlight=unix
with that functions you can convert time to C++ format and then use standard C++ functions to get seconds/minutes/hours from this time.
To use any indicator that you can see in Forex Tester you need to create it first in ResetStrategy procedure and get handle of it (this will put it on the chart). Then you can use this handle to get values. See Strategies help file -> Access to indicators, functions CreateIndicator and GetIndicatorValue.
Parameters that you send to the CreateIndicator should be absolutely the same as you can see in its properties dialog window and in the same order (excluding buffer styles). So, for Moving Average it will be next call for example:
ma_handle := CreateIndicator('USDJPY', 60, 'MovingAverage', '64;0;0;Simple (SMA);Close');
// parameters are separated with ;
then you can use this handle
curr := GetIndicatorValue(ma_handle, 0, 0);
prev := GetIndicatorValue(ma_handle, 1, 0);
second parameter is number of bar, third parameter is number of buffer (if you have more then one in this indicator, for example bollinger bands has 3 buffers for 3 lines)
_________________ Hasta la vista
Mike |
|
| Back to top |
|
 |
frank_horrigan

Joined: 16 Jan 2010 Posts: 7 Location: Pribram, Czech Rep.
|
Posted: Sun Jan 17, 2010 5:37 pm Post subject: |
|
|
| Terranin wrote: |
So, for Moving Average it will be next call for example:
ma_handle := CreateIndicator('USDJPY', 60, 'MovingAverage', '64;0;0;Simple (SMA);Close');
|
Thanks for advise, Mike, everything what I need now runs (or I have a way how write it But, your sample code as qouted above is mystificating, the good writing is as follows
| Code: | char EMABuff[1000];
sprintf(EMABuff, "%d;%d;%s;%s", EMAPeriod, 0, StrMAType(ma_EMA), StrPriceType(pt_Close));
iEMA = CreateIndicator(Pair, TF, "MovingAverage",EMABuff);
|
But all is ok, now I can write everything which I can understand how it works. Thanks again
_________________ The Market can stay irrational longer than you can stay solvent |
|
| Back to top |
|
 |
Terranin Site Admin

Joined: 21 Oct 2006 Posts: 831
|
Posted: Sun Jan 17, 2010 6:00 pm Post subject: |
|
|
| frank_horrigan wrote: | | Terranin wrote: |
So, for Moving Average it will be next call for example:
ma_handle := CreateIndicator('USDJPY', 60, 'MovingAverage', '64;0;0;Simple (SMA);Close');
|
Thanks for advise, Mike, everything what I need now runs (or I have a way how write it But, your sample code as qouted above is mystificating, the good writing is as follows
| Code: | char EMABuff[1000];
sprintf(EMABuff, "%d;%d;%s;%s", EMAPeriod, 0, StrMAType(ma_EMA), StrPriceType(pt_Close));
iEMA = CreateIndicator(Pair, TF, "MovingAverage",EMABuff);
|
But all is ok, now I can write everything which I can understand how it works. Thanks again  |
Yes, I tried to make it simple to understand. But note, MA has 1 more parameter now (help was not updated about that). So you need to write
| Code: | char EMABuff[1000];
sprintf(EMABuff, "%d;%d;%d;%s;%s", EMAPeriod, 0, 0, StrMAType(ma_EMA), StrPriceType(pt_Close));
iEMA = CreateIndicator(Pair, TF, "MovingAverage",EMABuff);
|
because new parameter was added for VShift. That's why you should check parameters of indicator in dialog window first. There is a trick, if you pass invalid parameters indicator will be still created but with default parameters and you will get a record in Journal about that. It can raise some problems later, if you strategy creates indicators - instead of reusing existing indicator on each start it will create new one, and you will get lots of indicators that will slow your testing.
_________________ Hasta la vista
Mike |
|
| Back to top |
|
 |
frank_horrigan

Joined: 16 Jan 2010 Posts: 7 Location: Pribram, Czech Rep.
|
Posted: Mon Jan 18, 2010 10:51 pm Post subject: |
|
|
| Terranin wrote: |
because new parameter was added for VShift |
Ok, I will get it for my mind, but it runs me without this additional parameter. Do I some mistake? (I had some problems with OrderCloseTime() and order handling variable, it is reason for I didnt reply soon - solved (I expected that if order is triggered and live, OrderCloseTime() returns zero, as in MT, but it isnt true, and I need to find other way [ I plan use the DLL as EA for MT, orderstotal() is non-effective for mine] VShift I undestrand asi vertical offset, similar to what is using envelopes, is it true? (I have very old version of FT, build 9) But, it is great tool for testing, I like it more and more If could be as replacement for MT, i would like to change it for this
_________________ The Market can stay irrational longer than you can stay solvent |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|