Can I callfunction TimeFrameGetPrice in Plugin?

Now, after my next AFL practice, I wanted to learn how to create plugins, so I downloaded the ADK to do some experimentation and practice.

I've read the CallFunction MACD example from the Sample in the ADK which states:

First you need to fill-in arguments table.

like this

	AmiVar arg[ 2 ];
	arg[ 0 ].type = VAR_FLOAT;
	arg[ 0 ].val = 12;

	arg[ 1 ].type = VAR_FLOAT;
	arg[ 1 ].val = 26;

Then can callfunction MACD like this

    AmiVar result = gSite.CallFunction( "macd", 2, arg );

	return result;

If I'm going to try CallFunction TimeFrameGetPrice what do i have to do
Can I do this, for example?

	AmiVar arg[ 3 ];
	arg[ 0 ].type = VAR_STRING;
	arg[ 0 ].val = 'H';

	arg[ 1 ].type = VAR_STRING;
	arg[ 1 ].val = "inDaily";

	arg[2].type = VAR_FLOAT;
	arg[2].val = -1 ;


    AmiVar result = gSite.CallFunction( "TimeFrameGetPrice",3,arg);

	return result;

If I'm wrong, is there any way to replace it?
Thank you all very much.

You can, but you shouldn't. DLLs are not meant to just call built-in functions. They are meant to provide their OWN functions that do something useful and expose NEW functionality instead of just calling already existing functions for sole purpose of hiding what you are doing.

1 Like

Thanks Tomasz, I'll try it in another way.
I will send the price from the TimeFrameGetpricefunction in AFL.
for calculations in plugins

and then return result back to AFL :grinning:

thank you very much