Can you tell me what lines of code I need to change to get the fields on indicator screen to not say "AlertOBStoch" and "AlertOSStoch". I'm not talking about the input field where I enter the wav file name, I'm talking about the other field in the left column.
Edit added - 5:45pm 2-18-10
Even though it says the error is in lines 138 and 146, I decided to take screencasts of the other 2 sections of code also. I thought I followed what you had done in your Stoch-D indicator but I've obviously got something slightly (or majorly) wrong.
For some reason, in order to have this indicator work for cases where price is piercing up thru the horizontal line AND cases where price is piercing down thru the horizontal line, you've got to select this indicator twice from the indicator list - one for uptrend and one for downtrend. That seems weird considering that the code seems to have places for "price breaking up thru line" and "price breaking down thru line".
Can you read the code well enough to understand why you would need two occurences of the indicator? If you understand it and it must be that way, can you explain it? If you understand it and can change the code so it won't need two occurences of the indicator, can you do that or tell me how to do that?
I can live with the indicator like it is (especially after I get issue #1 above resolved), however, it seems stupid to need two occurences of the indicator - 1 for uptrend and 1 for downtrend. But what do I know...
Thanks again for the help.
Last edited by Todd; February 18th, 2010 at 05:43 PM.
The following user says Thank You to Todd for this post:
to #1 - i think all you did is OK but the error is in lines 138 and 146 - right.
compare those lines again exactly with my example and have a look to what is written with a first big letter + what is written with a first small one - thats the key here i think.
all these micro-details - i also ran into these errors as i started to try my first codes 1,5 years ago or so -- i started with knowing nothing at all about coding - never learned this in school or elsewhere ... didnt know that there are such grazy traps - lol
1. If I wanted to change the code to have it give an alert if the horizontal line price is touched instead of just a close beyond it, how would I do that?
2. Do you know if it's possible to change the code so I don't need to put 2 of these indicators in my chart instead of just 1? This isn't a big hassle, it's just more of the principle... it seems like bad code to need to put 2 of the same indicator on the chart to make it work.
To make it work for price piercing up thru the line or price piercing down thru the line, I'm guessing that you would need to add some "OR" statements. But I don't know if that is easy to do in NT.
I've posted the current code at the bottom of this code if that is helpful to anyone. It's a work in progress but here are the improvements so far...
1. It works on instruments with 2 digits after the decimal (like ES) and also works on charts with 4 digits like 6a, 6e, 6b, etc.
2. Audio Input File Fields have been added to the indicator input screen so you don't have to be stuck with one alert or change the alert in the code.
hmm Todd - i realy try to help you to understand what you do in the code.
if we now have the Close of the Bar as a trigger-value - and it doesnt trigger when it only peaks the line and closes below it again - what do you think may help here ? its no big coding-trick - its just an easy logical thing.
about combining up+down alerts - it may give a lot of signals+noise if price oscilates around the line - maybe thats why its seperated now - its made as a clear one-time-signal when trigger happens.
you can try it with commenting out the "up or down- condition-check" like this and test how it behaves :
A minute ago I wrote a long reply but somehow when I hit submit, there was an error that erased it.
Anyway, I understand the "close of bar" logic. I just don't know the NT language so I don't know how to say "touch of price" with regard to the price bar. However, "close of bar" may be better because it may prevent from getting a bunch of alerts at one time as price moves back and forth across the line within 1 bar.
Regarding the uptrend/downtrend thing... I'll comment those lines out and see what happens. I'm guessing that the code will just stop working when I comment out those lines but we shall see.
Any idea why this indicator would only work in real time and not when I do market replay?
Last edited by Todd; February 21st, 2010 at 03:28 PM.
in general every Bar has 4 clear defined "datas" : Open / Close / High / Low
a peak of this line without a Close above means, that the price WAS above the line one time.
If the price was above ths line, i have the HIGH of this Bar above the line !
so i use the High instead the Close - thats my logical "trick" here.
why its not working on marketreplay -- dont know.
try the commenting-out - it should work - try if its making sense for your need.