How to control all open trades of an algo?

Posted By: nanotir

How to control all open trades of an algo? - 11/12/16 16:31

Hi

Currently there is NumOpenLong for each asset and each algo, and NumOpenTotal for all assets and algos. How to know all open long trades for all assets and one algo?
Posted By: boatman

Re: How to control all open trades of an algo? - 11/13/16 00:25

You can use the following macros:

This loops through all open, closed and pending trades:

Code:
for(all_trades)



This one loops through all open and pending trades:

Code:
for(open_trades)



This one loops through all open and pending trades of the currently selected asset/algo combination:

Code:
for(current_trades)



You get access to each individual trade's trade variables and trade statistics inside the loops.
Posted By: nanotir

Re: How to control all open trades of an algo? - 11/26/16 11:15

I may explained wrong my question.

The makros above let you loop through:
- Either all assest and all algos
- Or one asset and one algo

I want to loop or call in function all assets and one algo (not one asset/algo combination and not all assets/algos combination). Now, it maybe possible to call different assets inside the loops to get the statistics at the end of allassets and one algo combination, but it maybe easier if a function is already implemented for it, instead of manually calling all assets inside a loop.
Posted By: nanotir

Re: How to control all open trades of an algo? - 12/03/16 22:10

Any ideas?
Posted By: jcl

Re: How to control all open trades of an algo? - 12/05/16 08:22

He meant that you should loop through all open trades and count the trades with the desired algo.
Posted By: boatman

Re: How to control all open trades of an algo? - 12/05/16 09:17

I don't know of any existing functions that would allow you to do that, but you can do something like the following to operate on only the trades belonging to the current Algo:
Code:
string currentAlgo = Algo;
for(all_trades)
{
    if(strstr(Algo, currentAlgo))
    {
        ...
        do some stuff
        ...
    }
}

Posted By: nanotir

Re: How to control all open trades of an algo? - 12/06/16 15:29



I think that could work.

Thanks
© 2024 lite-C Forums