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

RE: Code Help



PureBytes Links

Trading Reference Links

Thanks for the replies, this is what I have. It doesn't take all the trades
it should but the ones it does take seem to be correct based on the logic. I
am thinking it's a reset problem, but not sure. Take a look below and see if
its something obvious to you, any suggestions appreciated.

Thanks,
Ned

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

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

MP = MarketPosition;
PctR = PercentR(80);
	
	If	PctR crosses over PctRBull Then Begin
	
		TriggerBar = BarNumber;
		Hi = High;
		Lo = Low;
		EntryPr = Hi + (.5*(Hi-Lo));
		StopPr = Lo - (.5*(Hi-Lo));
	
		If currentbar < TriggerBar + SetupLength then
			
		Buy ("L") (NumCont) Contracts  EntryPr stop;

	End;


	If	PctR crosses under PctRBear Then Begin

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

		If currentbar < TriggerBar + SetupLength then
				
		Sell ("S") (NumCont) Contracts  EntryPr stop;
		
	End;

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

If MP = -1 then ExitShort("SST") Numcont Contracts StopPr Stop;