[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Code Help!!



PureBytes Links

Trading Reference Links

I think the code to setup the entry and exits is correct now. The attached
gif shows the problem that I can't figure out. It will only go long on the
first bar after the entry / exit is established. The yellow arrow points to
where it should go long, but it won't. It has got to be something simple,
but I can't seem to find it.

Please take a look! Code is below.

Thanks
Ned

Input: 	NumCont(1),
		SetupLength(6),
		PctRBull(75),
		PctRBear(25);

Vars: 	MP(0),
		EntryPr(0),
		StopPr(0),
		Lo(0),
		Hi(0),
		PctR(0),
		TriggerBar(0),
		Counter(0);

MP = MarketPosition;
PctR = PercentR(80);
Counter = 0;

If PctR[1] < PctRBull 
	and PctR > PctRBull Then begin 

		TriggerBar = barnumber;
		Hi = High;
		Lo = Low;
		
		EntryPr = Hi + (.5*(Hi-Lo));
		StopPr = Lo - (.5*(Hi-Lo));

		if pctr > pctrbull
		and currentbar >= triggerbar 
		and currentbar <= triggerbar + setuplength then
		Buy ("L") (NumCont) Contracts EntryPr stop;
end;

If MP = 1 then ExitLong("LST") Numcont Contracts StopPr Stop;


This communication may contain information that is proprietary, privileged,
confidential or legally exempt from disclosure. If you are not a named
addressee, you are notified that you are not authorized to read, print,
retain, copy or disseminate this communication without the consent of the
sender and that doing so may be unlawful. If you have received this
communication in error, please notify the sender via return e-mail and
delete it from your computer.


Attachment:
Junk1.gif
Description: GIF image
Input: 	NumCont(1),
		SetupLength(6),
		PctRBull(75),
		PctRBear(25);

Vars: 	MP(0),
		EntryPr(0),
		StopPr(0),
		Lo(0),
		Hi(0),
		PctR(0),
		TriggerBar(0),
		Counter(0);

MP = MarketPosition;
PctR = PercentR(80);
Counter = 0;

If PctR[1] < PctRBull 
	and PctR > PctRBull Then begin 

		TriggerBar = barnumber;
		Hi = High;
		Lo = Low;
		
		EntryPr = Hi + (.5*(Hi-Lo));
		StopPr = Lo - (.5*(Hi-Lo));

		if pctr > pctrbull
		and currentbar >= triggerbar 
		and currentbar <= triggerbar + setuplength then
		Buy ("L") (NumCont) Contracts EntryPr stop;
end;

If MP = 1 then ExitLong("LST") Numcont Contracts StopPr Stop;

Attachment: Description: ""