Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,534 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Do LossStreakLong/Short reset for phantom wins? #438146
03/08/14 15:41
03/08/14 15:41
Joined: Jul 2013
Posts: 522
D
dusktrader Offline OP
User
dusktrader  Offline OP
User
D

Joined: Jul 2013
Posts: 522
The manual for LossStreakLong and LossStreakShort says:
Quote:
Current number of losses in a row, or 0 if the last trade was a winner.

It seems like this reset to 0 does not work for phantom trades, but does work for real trades (ie Lots=1). Can you please confirm?

In my logic, I want to switch to phantom mode if the recent string of trades are a loss, but then switch back to real trading once there is at least 1 phantom win. I am trying to turn off trading during the chop period but restart when trending resumes.

For example, in this code I can see that the streak counter is getting reset to 0 periodically, but only if I never switch to phantom mode. Once I enable the phantom trades, the counter stops resetting.
Code:
if (Price[0]>LowPass200 && trend==1)
	{
		//if (LossStreakLong>3) Lots=-1; //phantom
		//else 
		{
			Lots=1;
			reverseLong(1,tmf);
		}
	}
	else if (Price[0]<LowPass200 && trend==0)
	{
		//if (LossStreakShort>3) Lots=-1; //phantom
		//else
		{
			Lots=1;
			reverseShort(1,tmf);
		}
	}


THANKS

Re: Do LossStreakLong/Short reset for phantom wins? [Re: dusktrader] #438179
03/09/14 07:55
03/09/14 07:55
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
No. According to the manual, all statistics variables ending with "Long" or "Short" include phantom trades. If a trade wins, the loss streak is 0. Otherwise it whould be equal to the number of losses, which is obviously not the case.

So your problem has maybe a different reason. Maybe some code in your script treats phantom trades differently?

For testing phantom trade behavior, begin with a very simple script that just opens phantom trades at random, and plot the loss streak variables in the chart. This way you can check step by step which part of your code may affect them. If the problem still persists, please post the full code here and I'll look through it.

Re: Do LossStreakLong/Short reset for phantom wins? [Re: jcl] #438214
03/10/14 10:20
03/10/14 10:20
Joined: Jul 2013
Posts: 522
D
dusktrader Offline OP
User
dusktrader  Offline OP
User
D

Joined: Jul 2013
Posts: 522
Seems like I'm doing something wrong because the simple example works, from what I can tell. I'll take a closer look at my original script then.
Code:
function run()
{
	BarPeriod = 1;
	printf("\nLots=%.0f; LSLong=%i; LSShort=%i",Lots,LossStreakLong,LossStreakShort);
	plot("LossStreakLong",LossStreakLong,1,BLUE);
	plot("LossStreakShort",LossStreakShort,0,RED);
	plot("Lots",Lots,1,BLACK);

	static int iteration;
	if(is(INITRUN)) iteration=0;

	Stop = TakeProfit = 5*PIP;

	if(random() > 0) 
	{
		if(LossStreakLong>3) Lots=-1; else Lots=1;
		enterLong();
	}
	else 
	{
		if(LossStreakShort>3) Lots=-1; else Lots=1;
		enterShort();
	}

	if (iteration++ > (LookBack+150)) quit();
}


Thanks jcl


Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1