When I seek to add buy & sell signals to this script based on three moving averages, the engine painting the averages to the screen seems to go crazy. But I get no errors in the Formula Output window.
Announcement
Collapse
No announcement yet.
Is eSignal buggy?
Collapse
X
-
I should add that the more fundamental problem is not merely that the lines painted to the screen are wrong, but that the underlying calculations of the lines are also in error. This is clearly shown by one crossover-sell routine that sometimes does get painted to the screen. As shown by either the built-in MAs or a script with only those MAs, those crossovers actually occur earlier than the eSignal engine either calculates or posts to the screen.
My initial thought was that my installation of eSignal had somehow become corrupted, and so I de-installed and then re-installed it. But that changed nothing. Ditto with the script file and the .ACH file. Earlier I replaced both of those, transferring the code, etc. to new files. But that also did not help.
My best guess now is that some code in the buy or sell sections of this script is conflicting in some way with the underlying code in the eSignal engine. So while the script gets past the engine's error-checker, it still conflicts with something more fundamental in the engine itself. If this guess is correct, perhaps someone can point out how the code in the script is less than optimal, according to the engine's expectations.
Any help will be appreciated.
Steve
Comment
-
Hello Steve,
Yes, there are a few bugs, however, the problem that I'm seeing with your code is an unusual one. It seems like the engine should throw a formula error. I'm not sure at this time why it isn't, but I'll look into it further.
The problem with the indicators not plotting on some bars is caused by a syntax error in your return statement for the arcSell() function. You are using the single line comment characters in the middle of the statement. The engine doesn't appear to be recognizing this error, so it simply exits the formula execution.
The solution to this problem is to remove the two forward slashes just before your first && operator. It should be as follows.
PHP Code:function arcSell() {
return(
(ema8 > wma30) &&
(ema8 < ema8Aray[1]) &&
(yeloRasch > whiteRasch) &&
(whiteRasch > 0)
);
}
Jason K.
Project Manager
eSignal - an Interactive Data company
EFS KnowledgeBase
JavaScript for EFS Video Series
EFS Beginner Tutorial Series
EFS Glossary
Custom EFS Development Policy
New User Orientation
Comment
-
-
You're most welcome.Jason K.
Project Manager
eSignal - an Interactive Data company
EFS KnowledgeBase
JavaScript for EFS Video Series
EFS Beginner Tutorial Series
EFS Glossary
Custom EFS Development Policy
New User Orientation
Comment
-
Uh-oh... another glitch
Wouldn't you know it -- immediately stumbled on another conundrum.
In this particular script, the eSignal engine now can't recognize a short-term moving average when it's above a longer one.
There should be -- on the attached chart -- arrows BELOW the moving averages pointing up, just as there are arrows ABOVE pointing down.
The engine also, on this script, apparently does not actually go through all the bars, running the script.
Try specifying a particular set of nBarCounter values in the maCrossUp() function. DebugPrintln code sent to the Formula Output window repeatedly suggests the engine quits checking after just a few bars.
If the problem is a syntax error again, I can't see it. Fortunately, this is a much shorter, simpler script to check.
SteveLast edited by Steven Miller; 06-04-2007, 09:08 PM.
Comment
-
Steven,
I noticed on lines 47 and 229 that you were missing semicolons. While JavaScript allows the use of a newline as a statement separator, I thought return statements require semicolons. Perhaps the problem you are having is related to this oversight. (I did not attempt to run the code).
Originally posted by Steven Miller
In the initial problem, at the start of this thread, JasonK spotted the syntax error that the eSignal formula checker did not. However, the subsequent problem -- eSignal's inability to execute the newer script -- has not been resolved.
Steve
Comment
-
Hello Steven,
The current problem that I see with your formula code revolves around your code logic that sets the value for your bLong variable.
As your formula is currently coded, bLong is getting set to true on the first execution of the formula and your code logic does not allow it to be reset back to false. Therefore, your code inside the if (!bLong) condition is not being allowed to execute on subsequent bars. One reason for this that I can see has to do with your code logic for your buyCtr variable. It is initially set to 0. Therefore on the first execution of the formula where your buy signal condition first evaluates, if maCrossUp() or maTestUp() returns true, buyCtr gets incremented to a value of 1. As a result, your condition that follows the maCrossUp() and maTestUp() conditions first checks for a buyCtr value greater than 0.
if (buyCtr > 0) {
...
This forces this condition to always evaluate to true, which sets the value of bLong to true accordingly.
In your sell signal block of code, the logic there never allows bLong to be set back to false. You can verify this by placing some debugPrintln() statements just prior to where bLong is being assigned a value of false. In the sell signal block you have a condition checking the value of sellCtr, which is also initially set to 0. However, you are not incrementing this variable anywhere in your code so your condition,
if (sellCtr > 0) {
.... always evaluates to false and goes into the corresponding else statement. Inside this else statement your initial if statement is checking the value of your wasLong variable, which is always true, which sets bLong to true accordingly. This causes your initial buy condition to evaluate to false preventing your buy conditions from being evaluated.
Because the sellCtr is not being incremented your code logic allows all of the down arrows to be drawn. Commenting out or removing your two lines of code that increment the buyCtr variable (i.e. buyCtr++) will allow the up arrows to be drawn on the chart. Give that a try. I'm not sure if this is the exact solution you are looking for, but it should help you move forward with the development of the formula.
Jason K.
Project Manager
eSignal - an Interactive Data company
EFS KnowledgeBase
JavaScript for EFS Video Series
EFS Beginner Tutorial Series
EFS Glossary
Custom EFS Development Policy
New User Orientation
Comment
-
You're most welcome.Jason K.
Project Manager
eSignal - an Interactive Data company
EFS KnowledgeBase
JavaScript for EFS Video Series
EFS Beginner Tutorial Series
EFS Glossary
Custom EFS Development Policy
New User Orientation
Comment
Comment