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

Reply
Old 08-02-2009, 09:00 AM   #1

Join Date: Nov 2008
Location: Kialla
Posts: 55
Ignore this user

Thanks: 16
Thanked 1 Time in 1 Post

Plot Statement Issue

I have constructed the following code that I want to plot only on a direction chane in the average:

If PlotSlow=True and Displace >= 0 or CurrentBar > AbsValue( Displace ) then
begin
If Value2[2]<=Value2[1] and Value2>=Value2[1] then
Plot6(Low-Offset,"Up") else
if Value2[2]>Value2[1] and (Value2 < Value2[1]) then
Plot7(High+Offset,"Dn") else
NoPlot(6);

I only want a single plot when the condition is true but I get plots most of the time.

Where am I wrong here. Cannot see the forest for the trees sort of question.
PeterBrazel is offline  
Reply With Quote
Old 08-02-2009, 09:21 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: Plot Statement Issue

the following can be interpreted multiple ways:

If PlotSlow=True and Displace >= 0 or CurrentBar > AbsValue( Displace ) then


suggestion:
use brackets to isolate multiple/complex Boolean logics.


.

Last edited by Tams; 08-02-2009 at 10:01 AM.
Tams is offline  
Reply With Quote
Old 08-02-2009, 09:35 PM   #3

Join Date: Nov 2008
Location: Kialla
Posts: 55
Ignore this user

Thanks: 16
Thanked 1 Time in 1 Post

Re: Plot Statement Issue

Special thanks for all the assistance you have given me over various posts Tams. Whilst my programming skills are very weak you have assisted me to struggle through several issues such that I have ultimately achieved my original objective with several indicators.

My current issue relates an adaption of the jtHMA to have showme's plotted only when the the MA changes from up to down and vice versa.

This code:

"Displace >= 0 or CurrentBar > AbsValue( Displace ) then "

was lifted directly from the jtHMA code. Commenting it out does not seem to change my output result one way or other, that I can see.

I am getting plots above and below each bar rather than just on the bar where the MA changes from up to down and vice versa.

I have attached a screenshot of my code and the output.
PeterBrazel is offline  
Reply With Quote
Old 08-02-2009, 09:36 PM   #4

Join Date: Nov 2008
Location: Kialla
Posts: 55
Ignore this user

Thanks: 16
Thanked 1 Time in 1 Post

Re: Plot Statement Issue

Sorry...here is the attachment
Attached Thumbnails
Plot Statement Issue-code-jthma.png  
PeterBrazel is offline  
Reply With Quote
Old 08-02-2009, 09:52 PM   #5

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: Plot Statement Issue

.
If PlotSlow=True and Displace >= 0 or CurrentBar > AbsValue( Displace ) then
begin

If Value2[2]<=Value2[1] and Value2>=Value2[1] then
Plot6(Low-Offset,"Up") {<--- this plots below}

else
if Value2[2]>Value2[1] and (Value2 < Value2[1]) then
Plot7(High+Offset,"Dn") {<--- this plots above}

else
NoPlot(6);

.

Last edited by Tams; 08-02-2009 at 10:11 PM.
Tams is offline  
Reply With Quote
Old 08-02-2009, 09:56 PM   #6

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: Plot Statement Issue

try this:


If PlotSlow=True and Displace >= 0 or CurrentBar > AbsValue( Displace ) then
begin
If (Value2[2]<=Value2[1] and Value2>=Value2[1] )
or
(Value2[2]>Value2[1] and (Value2 < Value2[1])) then
Plot7(High+Offset,"Dn") else
NoPlot(6);
Tams is offline  
Reply With Quote
Old 08-02-2009, 10:57 PM   #7

Join Date: Nov 2008
Location: Kialla
Posts: 55
Ignore this user

Thanks: 16
Thanked 1 Time in 1 Post

Re: Plot Statement Issue

Thanks once again.
I copied your code but the result is unchanged.
PeterBrazel is offline  
Reply With Quote
Old 08-02-2009, 11:04 PM   #8

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: Plot Statement Issue

did you copy the whole thing in post #6?

can you draw a mock up to illustrate how you want it plot?
Tams is offline  
Reply With Quote

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
What is the Difference Between IF and While Statement? rajatheroyal Automated Trading 1 07-29-2009 01:31 AM
TradeStation Easy Language Reutrn Statement tcyue1984 Automated Trading 2 05-27-2009 04:01 PM
Chat Issue jonbig04 Support Center 5 05-06-2009 12:51 AM
Firefox Memory Issue brownsfan019 Tools of the Trade 13 12-22-2008 02:40 PM
How to plot MP using IB data feed? jj2005 Market Profile 0 03-14-2007 10:34 AM

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