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

Reply
Old 11-27-2009, 11:29 AM   #17

Tams's Avatar

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

Thanks: 2,027
Thanked 1,402 Times in 862 Posts



Re: Help Needed For Indicator

Quote:
Originally Posted by BlowFish »
Actually that was why I tried to help compared t0o many posters he did a reasonable job of describing what he was trying to do . He posted some code that he had taken a stab at, reasonably clearly described what he was trying to do and posted a chart with an illustration of how it looked and how it should look. Compared to many of the "please help" posts a zillion miles ahead ! I think (though I may be mistaken) there was enough information in the original post to provide a solution. Time will tell I guess!

Having said that your advice was spot on for him finding the solution for himself.

I agree that he did a reasonable job of trying...
especially posting his work-in-progress. (I give credit to that... some people are too shy to post)

If he had written out his thoughts one line at a time in this format:

IF...
THEN...
ELSE...

he would have avoided the error.




p.s. I think he had solved the problem already...
This is a simple bug, you have given him the clue he needed. it is not that difficult to spot the fault once he thinks it through.
In an anonymous forum, some people just don't have the habit of acknowledging help.
__________________


..........This is a terribly difficult question to answer. The only satisfactory answer is: "It depends"...

Last edited by Tams; 11-27-2009 at 11:51 AM.
Tams is offline  
Reply With Quote
Old 11-27-2009, 11:32 AM   #18

Join Date: May 2008
Location: London
Posts: 41
Ignore this user

Thanks: 23
Thanked 21 Times in 15 Posts



Re: Help Needed For Indicator

Besides the advice that Tams gave about writing out your rules in English in advance, I would also suggest that you always include some print statements for use during debugging. An example is shown below:

Print(ELDATETOSTRING(Date ), " ", Time, " LongTrigger: ", LongTrigger, " LongTriggerValue: ", longtriggervalue, " Fastvalue: ", fastvalue, " Slowvalue: ", slowvalue, " A");

The idea is to print out the current values of important variables on each bar. These print out to the Easylanguage output bar, which can be automatically saved to a file upon exit. Each one shows the date and time of the bar plus the variables required. Note that I have also included a reference "A" at the end, because you might want to insert the same print statement at different points in your logic to see how the variables change as the code is processed. By using a different reference for each print statement you can see exactly which part of the code triggers any changes in values.

Normally this will highlight any problems with your logic. Logic/coding problems are IMHO the normal cause of funny results, rather than TS technical issues.

It can be useful also to have an input at the start of the statement, something like:

Inputs:
Print_On("N");

Then you can add a line before the print statement:

If Print_On = "Y" then print(message that needs to be printed);

This allows you to turn the printing on or off during run-time by changing the input.

Charlton
Charlton is offline  
Reply With Quote
The Following 2 Users Say Thank You to Charlton For This Useful Post:
aaa (11-28-2009), Tams (11-27-2009)
Old 11-27-2009, 11:36 AM   #19

mrtraderguy's Avatar

Join Date: Nov 2009
Location: Miami
Posts: 15
Ignore this user

Thanks: 1
Thanked 2 Times in 2 Posts



Cool Re: Help Needed For Indicator

Quote:
Mr T G, You can often learn something new by how others approach problem. There was a great thread "plotting globex highs and lows" or something similar. What was good about it is that several methods to do it where presented, some from fairly novice coders. Anyway reading back my post sounds unduly critical that was not my intention, apologies.
No worries, I agree BFish, that's why I just provide options and take nothing personally :-) I've coded in other areas for years, and yet find myself in a new category every day! The only thing we know for sure is that we don't know everything!

Always happy to help where I can and learn everything along the way :-) OK, I'm back to work!
mrtraderguy is offline  
Reply With Quote
Old 11-29-2009, 06:51 AM   #20

Join Date: Jul 2009
Location: Paphos
Posts: 36
Ignore this user

Thanks: 9
Thanked 6 Times in 1 Post



Re: Help Needed For Indicator

Hi, and many thanks to you all for all your help with this so far.

Blowfish, I put the code, exactly as you posted into ts and ran it on GBPUSD 5 min data.

I attach 3 charts which are showing the problems I am having with this show me. ( Also plotted are the fast and slow moving averages ( the thick ones ) which change to green when both the slow and fast MAs are pointing up. )

I have market the charts with lines and put text at the places that the problems are ocurring, to make things easier to see, as previously suggested by Tams.

Once again, many thanks for all your help.
Attached Thumbnails
Help Needed For Indicator-screenhunter_01-nov.-29-10.34.gif   Help Needed For Indicator-screenhunter_02-nov.-29-10.35.gif   Help Needed For Indicator-screenhunter_03-nov.-29-10.37.gif  
nab999 is offline  
Reply With Quote
Old 11-29-2009, 11:29 AM   #21

Tams's Avatar

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

Thanks: 2,027
Thanked 1,402 Times in 862 Posts



Re: Help Needed For Indicator

You did not say WHY this is plotting correctly.
What is your criteria that makes it "correct"?
What should the chart do if the criteria is not met ???

What about the "incorrect" plot?
What is your criteria it did not make that renders it "incorrect"?
What should the chart do if the criteria is not met ???

You might have described your codes in one post or anther,
but don't expect people to look for that section of code...
because that code is "wrong"... it is not producing the effect you want, how can people match that section of code to this picture????
I see lots of lines... do you know which line is which?
Do you know what variables you are evaluating against which?
I don't.


Can you see that your thoughts are not cohesively articulated
and the logic description are incomplete?
Computers are dumb. They can only do what you tell it to do.
If your logic is incomplete, so is the computer's action.


If you are looking a solution... this is the place you really have to make an effort to cover all the bases...
So far I only see you swimming around in shallow water...


__________________


..........This is a terribly difficult question to answer. The only satisfactory answer is: "It depends"...

Last edited by Tams; 11-29-2009 at 11:59 AM.
Tams is offline  
Reply With Quote
Old 12-05-2009, 07:27 AM   #22
aaa

aaa's Avatar

Join Date: Jun 2008
Location: Switzerland
Posts: 440
Ignore this user

Thanks: 238
Thanked 278 Times in 135 Posts



Re: Help Needed For Indicator

ThanX TAMS 2 write 18 lines 2 repeat it again & again

This is what I've leanred from TAMS

2 B clear

First in my head 4 my personnal work

Then 4 the others 2 receive the correct answer

But The road is hard...
aaa is offline  
Reply With Quote

Reply

Tags
moving average

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help Needed for Indicator DutchAngel Coding Forum 4 04-16-2009 06:22 AM
WOLFE WAVE Indicator Needed ropulos Coding Forum 29 12-24-2008 03:18 AM
Chaikin's Volatility Indicator Needed TipsyTzar Coding Forum 4 12-01-2008 03:25 AM
Indicators needed ( help) stocktrader.in Coding Forum 4 11-18-2008 02:44 PM
just what i needed xztheericzx Beginners Forum 0 11-04-2007 06:21 AM

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