Hey JCL,

I'll explain what I want to do, without using "Array" or "Linked-List"...

I have a trade and money management theory that I want to put into action. It is based on multiple timeframes of a single asset (though I will expand it to other assets some time down the line).

For this example, I want to trade on the M5, M15, H1, H4, and D1 timeframes.

When I enter a trade on the M5, I want to put that trade's ID into one of two groups - M5Buy, or M5Sell. These groups will have their own trailing stop settings.

Once an M5 trade has a certain amount of profit protected by a stop, I want to remove that trade from its current group, and add it to another group (M5Export).

When there is an entry signal in the same direction on the M15 as one of the M5 trades, I will enter a trade on the M15 timeframe, and when its stop is moved to break-even, I want to import the trade from the M5Export group into the M15Buy or M15Sell group, and move its stop accordingly. When those trades have had their stops moved a certain distance in accordance with the M15 trailing stop, I want to move them from the M15Buy or M15Sell group into the M15Export group.

Continue moving trades as above for the other timeframes used in the system.

=========

Now, onto what I've read about Arrays in C, Lite-C, and C++...

1.i. Unless an array is global in scope, if you pass an array to a function, and manipulate (Resize or Sort) it in that function, the effects are only local to that function. Correct?
1.ii. Or can you declare dynamic arrays anywhere and have any changes made within functions visible to other functions (without passing directly from one function to another)?

2. If you try and get the size of an array in Lite-C, you only get the size of the pointer. Correct?

3. Another way to get the size of an array is to get the size of a single element (on further reading, I found that I can get sizeof(*DataType) in C), then multiply that by the number of elements (as long as I keep count of the elements within each function, and can access that count within every function, I should have no problems). Correct?

4. Arrays are allocated to contiguous blocks of memory. Correct?

As for the mql4 example I posted, the main point was to show how easy it was to manipulate arrays in mql4 (that script was the first thing I wrote from scratch in mql4). The Stoch stuff was for an EA I was modifying, but the main functions that I wanted to be able to use in this particular case are StoreTrades, ClearClosedTrades, and TrimDoubleArrays (or TrimArrays), as well as a couple of others for exporting/importing trades from one group to another.

If that cannot be done purely in Lite-C, then I now have an alternative...

===============

What I've read about Linked Lists...

1. They are quick and simple to create. Correct?

2. Nodes are allocated memory in any free space on the heap, which has the potential of causing memory fragmentation (though they'd have to be ridiculously large to cause that). Correct?

3. You always have to traverse an LL from the head (unless you create a doubly-linked list, so that you can traverse from the tail also) Correct?

4. Passing LL's to functions is easier, and any changes made within those functions are carried through to the rest of the program. Correct?

======================

Back to my trade & money management theory...

All changes to the groups must be both permanent, and visible to any other part of the program that needs access to them, regardless of whether they are accessed & changed within Main(), whether functions that change them are called from within Main(), or they are called from within another function.

I'm not flexible about the system, but I am flexible about the method(s) used to achieve that system wink

Thanks for your help laugh


Have fun!
Radar =8^)