Discussion in 'Strategy Building' started by Ginu09, Apr 5, 2021.
What will the report look like?
It doesn't seem to work for a lookbackDays > 1
I'd just like a single line to show on the intraday chart for the first day high from the daily that is greater than the current day's open as an indication of overhead resistance.
It's funny, I can get the code to work when I hardcode the "currentOpen = 1.24". However, if I use this code:
def currentOpen = if getTime() crosses above RegularTradingStart(getYYYYMMDD()) then open else currentOpen;
it fails. On a multi-day chart, when TOS goes through the various days on the chart, will currentOpen here store today's open only or the open of the day on the chart being evaluated?
I think I am still guessing at what you want.
This just displays a horizontal line on the last day of an intra-day chart at the level of the highest bar of the day index provided as the input.
You may find someone that understands what you mean in the ThinkScript Chat on TOS. Some very clever folks on there!
def barRef=if ReferenceValue!=ReferenceValue then barnumber() else barRef;
def plottime=barRef==highestall(barRef) ;
plot PriorDayHigh=if (plottime) then ReferenceValue else double.nan;
If you provide some actual rendition of what you are doing, may go a long way for discovering what you are trying to do. A chart, with symbol, and your timeframe (none of which has been disclosed).
Do you have code which does something, and you wish it did something else and provide some hints?
Here's an example in the attachment. I'd like to automatically display the first high from the daily chart that is greater than the open price from today (this move was from yesterday). Here the high would be 2.19 from 10 days ago with the open at 2.12. The duration of days (lookback period) can be anything and I wouldn't want to have to specify it ideally (who knows how many days ago the previous high would be).
For the code that you posted, I set a lookback period of 50 and it didn't post anything.
Hope that helps to clarify! and thanks for your help.
Separate names with a comma.