Hey JCL,

Thanks for that laugh

I'm trying to create a multi-timeframe system, and to manage trades according to their entry timeframe's settings, eventually pushing them up through the higher timeframes.

I was able to create that structure in mql4 by using arrays, so I thought I'd use the same system in lite-C, but it's going to be a little more difficult, I think.

I have to admit that whilst most of mql4 is a major pain in the butt, their array manipulation was pretty straight-forward for the user.

I'm currently attempting to build functions to do the same thing, but am coming across syntax errors, and I can't see what's causing them frown

Here's what I've got so far...

Code:
#include <default.c>
#include <intArraySort.c>

var counter[10] = {10, 1, 9, 2, 8, 3, 7, 4, 6, 5};
int countersize = 10;
int content = 0;

function start()
{
	for (int index = 0; index < countersize; index++)
	{
		content = counter[index];
		printf("n\ Element %d contains %d." index, content);
	}

	intArraySort(counter, countersize, "Ascend");

	for (int index = 0; index < countersize; index++)
	{
		content = counter[index];
		printf("n\ Element %d contains %d." index, content);
	}
	
	intArraySort(counter, countersize, "Descend");

	for (int index = 0; index < countersize; index++)
	{
		content = counter[index];
		printf("n\ Element %d contains %d." index, content);
	}
}



...and the intArraySort function...

Code:
function intArraySort(int *MyArray, int MyArraySize, string Method)
{
		
	if (Method == "Ascend")
	{
		for(int x=0; x<MyArraySize; x++)  // I get syntax errors for this line :(
		{
			int index_of_min = x;
			for(int y=x; y<MyArraySize; y++)
			{
				if(MyArray[index_of_min]>array[y])
				{
					index_of_min = y;
				}
			}
			int temp = MyArray[x];
			MyArray[x] = MyArray[index_of_min];
			MyArray[index_of_min] = temp;
		}
	}
	else
	if (Method == "Descend")
	{
		for(int x=0; x<MyArraySize; x++)
		{
			int index_of_min = x;
			for(int y=x; y<MyArraySize; y++)
			{
				if(MyArray[index_of_min] < array[y])
				{
					index_of_min = y;
				}
			}
			int temp = MyArray[x];
			MyArray[x] = MyArray[index_of_min];
			MyArray[index_of_min] = temp;
		}
		
	}
} // End _intArraySort



If you can tell me why I get the syntax error, and how to fix it, I'll wrestle with any other errors in the code... It's the only way I learn this stuff... Copy, paste, & edit until it does what I want... I can't learn from books frown

As I said, I want to be able to enter trades in different timeframes of the same instrument, and manage them separately, in order to calculate total protected profit for each timeframe. If my protected profit for a given timeframe is enough to cover the potential loss of a scale-in trade, then I'll scale-in, add that to the list of trades to be managed, then check the next timeframe up.

The idea is to build a pyramid of trades, with the pointy end down wink Check out my "My Weird Trade & MM System" (link is in first post) to see where I'm heading with this.


Have fun!
Radar =8^)