getting an error message when i try thatby donmat - Trading Discussion
Is there a way to combine these 2 statements so N/A doesn't show up in the label? AddLabel(yes,if buy then ((close-open)*.25)+open else double.NaN,color.lighT_GREEN); AddLabel(yes,if sell then ((open-close)*.75)+close else double.NaN,color.pink);by donmat - Trading Discussion
In the following code I would like the line to be drawn right beneath the low of the defined length. As is sometimes the scaling is a little out of whack: def lineLength = length; def barNumber = BarNumber(); def barCount = highestAll(If(IsNaN(close), 0, barNumber)); def closeLine = if barNumber == 1 then Double.NaN else if barNumber == barCount - lineLength then close[-lineLength] else ifby donmat - Trading Discussion
This works for daily charts but when I switch to Intraday 15 min chart the levels are different, however yesterdays close level is correct. def HHV = Highestall(high); def LLV = Lowestall(low); def x = ((HHV - LLV) / 8); def limit = x * .4; def z = (x -limit)*1.2; def Long=Close(period = "day" ) from 1 bars ago - limit; def Short=Close(period = "day" ) from 1 bars agoby donmat - Trading Discussion
Courtesy of Thinkscript Lounge: input barstoshow = 20; def lastBar = if isNaN(close[-1]) && !isNaN(close) then barnumber() else double.nan; plot ema10=if barnumber()>=highestall(lastbar-barstoshow) then expaverage(close,10) else double.nan;by donmat - Trading Discussion
Is there a way to only display the last 20 bars on a 10-minute chart for an indicator?by donmat - Trading Discussion
The AD14) on the daily is already kinda smooth, 28 period would be too much? ADXR is already a smoothed version of ADX. I use Wilders Smoothing alot, could write the code later.by donmat - Trading Discussion
Here's the one that finally worked. Thanks for your help. input stop = 5; input target = 10; def entry = EntryPrice(); def StoppedOut = low <= (entry - stop); def TargetMet = high >= (entry + target); def Sell1pm = SecondsFromTime(1345) >= 0 and SecondsFromTime(1400) <0 ; def Price1pm = if Sell1pm then close else Double.NaN; def exit = StoppedOut or TargetMet or Sell1pm;by donmat - Trading Discussion
This seems to be what I want. def Bar1PM = SecondsFromTime(1345) >= 0 and SecondsTillTime(1400) > 0; input stop = 5; input target = 10; def entry = entryPrice(); def exit = if (high >= (entry + target) or low <= (entry - stop)) then 1 else 0; def exitPrice = if (high >= (entry + target)) then (entry + target) else (entry - stop); AddOrder(OrderType.SELL_TO_CLOSE,exit,by donmat - Trading Discussion
Is it possible in TOS to create a fixed Stop loss order in a strategy that would exit at the current bar and not the open of the next bar?by donmat - Trading Discussion
I'm trying to write a strategy that would enter at 10am CST and exit at 1pm CST. For simplicity at 10am the close has to be above the 10-period MA on a 15 minute chart. Can someone give me an example?by donmat - Trading Discussion