Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,175 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
2 lines EL to check Trend Following Market - Convert to Lite-C #487048
01/05/23 05:59
01/05/23 05:59
Joined: Nov 2018
Posts: 11
A
aventador Offline OP
Newbie
aventador  Offline OP
Newbie
A

Joined: Nov 2018
Posts: 11
Hi,

I'm not sure if the translation from EL to Lite-C below is correct or not but the result is different when i compare.

i made 2 programs and tried to get same result with EL but still not the same.

Tested on EUR/USD historical data provided by zorro.

Can shed some light what is the issue ?


Easylanguage

Buy next bar at highD(1) stop;

Sellshort next bar at LowD(1) stop;


lite-C

1st Code:
Code
function run() 
{
        set(LOGFILE);
	BarPeriod = 1440;
	StartDate = 20130101;
	EndDate = 20181231;
	//asset("EUR/USD");
	
	//... 
	
	Hedge = 0;
	LookBack = 1;
	MaxLong = MaxShort = -1;
	
	var Highp = dayHigh(UTC,1);
	var Lowp = dayLow(UTC,1);
	
	/* Check if Trend following */
	//static int i = 0;
	
	//printf("\n No %i, previous high = %.5f, previous low = %.5f", i, Highp,Lowp);
	
	if(NumOpenLong == 0 && NumOpenShort == 0)
	{
		enterLong(1, Highp);
		enterShort(1,Lowp);
	}	
	
	if(NumOpenLong == 1 && NumOpenShort == 0)
	{
		if(price() <= Lowp)
		{
			exitLong();
		}		
	}else if (NumOpenShort == 1 && NumOpenLong == 0)
	{
		
		if(price() >= Highp)
		{
			exitShort();
		}		
	}
}


2nd Code:

Code

function run() 
{
	set(LOGFILE);
	BarPeriod = 1440;
	StartDate = 20130101;
	EndDate = 20181231;
	//asset("EUR/USD");
	
	//... 
	
	Hedge = 0;
	LookBack = 1;
	MaxLong = MaxShort = -1;
	
	var Highp = dayHigh(UTC,1);
	var Lowp = dayLow(UTC,1);
	

		enterLong(1, Highp);
		enterShort(1,Lowp);

		
}


Re: 2 lines EL to check Trend Following Market - Convert to Lite-C [Re: aventador] #487049
01/05/23 08:02
01/05/23 08:02
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929

Re: 2 lines EL to check Trend Following Market - Convert to Lite-C [Re: Spirit] #487050
01/05/23 08:31
01/05/23 08:31
Joined: Nov 2018
Posts: 11
A
aventador Offline OP
Newbie
aventador  Offline OP
Newbie
A

Joined: Nov 2018
Posts: 11



u r not helping at all. i'm lost unless there is example how to buy stop. i already tried as shown code earlier.


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1