| Coding Forum Collaborate, receive help, or discuss coding related issues. |
![]() | | Tweet | |
| | #1 | ||
![]() | Future Data Error in TS Indicator inputs: shortMA(3), longMA(10); vars: FastOsc(0), MomHigh(false), MomLow(false); if lastbaronchart=false then begin FastOsc=averagefc(c,short MA)-averagefc(c,longMA); if FastOsc=highest(fastosc,3 0) and fastosc>fastosc[-1] then begin plot1(fastosc,"mom high"); MomHigh=true; alert("Momentum High"); end; if FastOsc=lowest(fastosc,30 ) and fastosc<fastosc[-1] then begin plot2(fastosc,"mom low"); MomLow=true; alert("Momentum High"); end; end; | ||
| |
|
| | #2 | ||
![]() | Re: Future Data Error in TS Indicator fastosc>fastosc[-1] then begin fastosc<fastosc[-1] then begin The should be: fastosc>fastosc[1] then begin fastosc<fastosc[1] then begin You cannot use negative values to reference the past bars/values. Today's value is fastosc[0], yesterday's is fastosc[1], two days ago is fastosc[2], etc. Tomorrow's bar theoretically would be fastosc[-1] and that is why you get the error. | ||
| |
|
| | #3 | ||
![]() | Re: Future Data Error in TS Indicator The idea behind using [-1] is to prevent the indicator from giving a false true signal if the full momentum high or low has not yet been put in. In other words, I need to check the subsequent bar to see if it's higher/lower and give signal ONLY if it isn't. Any idea on how to accomplish that? | ||
| |
|
| | #4 | ||
![]() | Re: Future Data Error in TS Indicator I have posted the code here on TL. you can see how it is done. | ||
| |
|
| | #5 | ||
![]() | Re: Future Data Error in TS Indicator | ||
| |
|
| | #6 | ||
![]() | Re: Future Data Error in TS Indicator Quote:
| ||
| |
|
| | #7 | ||
![]() | Re: Future Data Error in TS Indicator Quote:
| ||
| |
|
![]() |
| Thread Tools | |
| Display Modes | Help Others By Rating This Thread |
| |
| ∧ Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Pair Trading (future Vs Future at CME/Eurex) | Accumulator | Futures Trading Laboratory | 0 | 03-11-2009 02:52 PM |
| Url.dll Error - Help! | brownsfan019 | Tools of the Trade | 5 | 09-16-2008 05:50 PM |
| Indicator with Data of Another Indicator | Tresor | Coding Forum | 13 | 08-06-2008 10:48 AM |
| Error trying to check email address | brownsfan019 | Support Center | 6 | 05-29-2007 10:41 AM |