Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 767 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 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