Welcome to the Traders Laboratory Forums.
Coding Forum Collaborate, receive help, or discuss coding related issues.

Reply
Old 06-25-2009, 02:12 AM   #1

daedalus's Avatar

Join Date: Jul 2007
Location: Omaha, NE
Posts: 627
Ignore this user

Thanks: 431
Thanked 551 Times in 228 Posts

Debugging Questions... Phantom Alerts...

I know its almost impossible for you guys to help on this but I have a question that I can't seem to crack.

I have a simple show me indicator that checks for the bar to be an inside bar and then checks to see if it closed up or down through 78.6% of the candle.

If so, plot a dot and alert me...

Heres the code...

Code:
//Plot for shorts
if High[1] < High[2] and Low[1] > Low[2]  then 
begin
	//This Calcs the Fib Retracement
	Step1S = High - Low;
	Step2S = Step1S*.214;
	Step3S = Low + Step2S;

	if Close < Step3S then  //If the bar closes below the 78.6% retracment, print a dot and alert.
	Plot5(Step3S, "IB FO S 78.6", IBShortColor );
	Alert("IB FO S 78.6");
	end
else
	NoPlot( 5 );
The problem is that i'm getting alerts from bars that don't close through the 78.6% (I check for both instances in the code).

Here is the instance for regular bars...
Code:
//Plot after a fakeout for shorts
if High[1] < High[2] and Low[1] > Low[2] then 
	begin
	Plot3( Close, "IB Fakeout S", IBShortColor );
	Alert("IB Fakeout S");
	end
else
	NoPlot( 3 );
My problem is that in the following example I will only get the one dot signifying the correct signal (a non-78.6 insidebar) but my alert actually goes out as a 78.6 inside bar...





Anyone got any ideas on what stupid thing i'm missing? It can't be much but it sure as hell is driving me up the wall. I'm probably staring right at it. I need a new fresh set of eyes.

Thanks for your help gents as always!
Attached Thumbnails
Debugging Questions... Phantom Alerts...-untitled.png   Debugging Questions... Phantom Alerts...-untitled2.jpg  
daedalus is offline  
Reply With Quote
Old 06-25-2009, 08:03 AM   #2

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: Debugging Questions... Phantom Alerts...

try this... I have highlighted the changes

Code:
//Plot for shorts
if High[1] < High[2] and Low[1] > Low[2]  then 
begin
	//This Calcs the Fib Retracement
	Step1S = High - Low;
	Step2S = Step1S*.214;
	Step3S = Low + Step2S;

	if Close < Step3S then  //If the bar closes below the 78.6% retracment, print a dot and alert.

	BEGIN  {<---- add this}

		Plot5(Step3S, "IB FO S 78.6", IBShortColor );
		Alert("IB FO S 78.6");
	end
	else
	NoPlot( 5 ); 

END;  {<---- add this}
Tams is offline  
Reply With Quote
The Following User Says Thank You to Tams For This Useful Post:
daedalus (06-25-2009)
Old 06-25-2009, 11:14 AM   #3

daedalus's Avatar

Join Date: Jul 2007
Location: Omaha, NE
Posts: 627
Ignore this user

Thanks: 431
Thanked 551 Times in 228 Posts

Re: Debugging Questions... Phantom Alerts...

Dude. That fixed it... holy crap. I'd click the "Thanks" button 100x's if it let me. 1 Thanks just doesn't quite do it. I seriously can't thank you enough... i had been trying everything to no avail.

Can I ask what was the logic flaw? Every if statement needs a separate begin and end statement?
daedalus is offline  
Reply With Quote
Old 06-25-2009, 11:17 AM   #4

Tams's Avatar

Join Date: Sep 2008
Location: Geelong
Posts: 3,779
Ignore this user

Thanks: 2,084
Thanked 1,474 Times in 912 Posts

Re: Debugging Questions... Phantom Alerts...

You have to match every BEGIN with an END.

The best way to make sure they match is to indent all the codes within a BEGIN/END pair.

Last edited by Tams; 06-25-2009 at 11:24 AM.
Tams is offline  
Reply With Quote
The Following User Says Thank You to Tams For This Useful Post:
daedalus (06-25-2009)

Reply

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tradestation alerts ryounkin Technical Analysis 5 01-17-2010 12:55 PM
I Want Alerts Based on Specific Parameters? Johnson S. Mcdermott Trading and the Markets 5 06-08-2009 04:39 PM
Quote Tracker Paintbar Alerts? cbratton Tools of the Trade 0 01-08-2009 06:31 PM
Phantom of the Pits weiwei Books 15 06-26-2008 07:56 PM
Questions zhao77 Tools of the Trade 2 02-14-2008 05:42 AM

All times are GMT -4. The time now is 01:23 PM.
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.