Advertisements I want to use the Session Criteria for limiting the Strategy in her active time. As I know it should be working with the Session function, but something with my logic is not right. i_Handelszeit = input.session(title="Haupthandelszeit", defval = "0700-2000") // Check filter(s) isInSession(_sess) => not na(time(timeframe.period, i_Handelszeit)) f_dateFilter = time >= i_startTime and… Read More Session criteria is ignored
Advertisements I am just starting out learning PineScript and sorry if this question is very elementary. I want to compare three bars. If the middle bar’s high is greater than two others, then plot a shape above it by ‘plotshape’ command. The problem is that in the code below if the condition is true then… Read More Compare three bar and plot a shape (by using plotshape) above or below the middle Candle
Advertisements How can I copy a label from one time frame to another? This is the code I use to copy the label within the same time frame: label_name_x = label.get_x(label_name) label_name_y = label.get_y(label_name) new_label_name = label.new(label_name_x,label_name_y,text=str.tostring(text_label_name)) Using request.security() in the new time frame does not seem to work as I cannot define the variables/parameters… Read More Copying label to another time frame
Advertisements I am trying to highlight in background of my chart, when the market is flat. Obviously, I am doing something wrong, since the background is "completely" green. Would appreciate your expertise. // — Flatmarket START — // Calculate price range over a 10-bar period price_range = high – low // Set the threshold for… Read More Highlight the background of my chart according to condition
Advertisements I’m having an hard time debugging a Pinescript indicator. Here is the code //@version=4 study("Trend Regularity Adaptive Moving Average","TRAMA",overlay=true) length=input(99),src = input(close) //—- ama = 0. //debugging part txt = tostring(ama) x = bar_index y = src //end of debugging part label.new(x, y, txt) // print value of close hh = max(sign(change(highest(length))),0) ll =… Read More Pinescript – variable set to 0 returns a non zero value when referenced with an index
Advertisements I’m just trying to assign my variable (movingAv) with the value from the built-in simple moving average function. However, i’m getting the error "Could not find function or function reference ta.sma" for the line with my variable declaration on it. In the code editor "ta.sma" has turned blue so the editor must recognise the… Read More Pine Editor not compiling ta.sma() even though syntax correct
Advertisements I need to create counter like that: var count = 0 if a == b count := count + 1 But it doesn’t work! help please. I know that it is stupid question but i really dont know what to do >Solution : It works (and exactly like you have written) Below is a… Read More How to make variable-counter in pine script?
Advertisements I have 2 charts showing Nasdaq 100 E-mini Futures at 1 min intervals, one uses regular OHLC candles and the other uses Heikin Ashi. I have written a very simple indicator that plots either shape.triangleup or shape.triangledown on certain candles on the Heikin Ashi chart using its OHLC data and would like to show… Read More Plot indicator on chart with different candle setup but same timeframe
Advertisements I’ve tried to add alertcondition if area color is green/lime = buy and if red/maroon = sell, but since indicator is in v1 I can’t find any doc nor know how to program very well in v1. Could someone help me translate to v5 or put the alertconditions? thanks study(shorttitle = "SQZMOM_LB", title="Squeeze Momentum… Read More PineScript v1 alert
Advertisements I’m trying to give an entry whenever the background is green (TrendDirection == 1) and the price hits the purple line (pacU). Sample Long Position I’ve tried this to give me a signal whenever the lowest level of the candle is less than the line but it doesn’t give me any signals. haLow =… Read More How can I open a trade when the price touches the line?