pine-script

PineScript calculate EMA for One Candle in Future in Tradingview

…衆ロ難τιáo~ 提交于 2020-12-15 05:29:34
问题 I want to calculate an exponential-moving-average (EMA) with the EMA for one Candle in the future just by duplicating the last candle. Means I want to plot an EMA with an offset of 1 and the value, that is in the offset 1 bar is calculated based on the current candle. Unfortunately I think I have a wrong understanding of the series, why it doesn't work. But hopefully my code shows what I wanted to do: CustomEma(source, length) => alpha = 2 / (length + 1) ema = 0.0 // iterate through the

Label Horizontal EMA Lines (Variables)

让人想犯罪 __ 提交于 2020-12-15 05:29:10
问题 This is the Code I use atm. (Thanks to Bjorn Mistiaen) len1 = input(10, minval=1, title="Length") len2 = input(21, minval=1, title="Length") len3 = input(55, minval=1, title="Length") len4 = input(100, minval=1, title="Length") len5 = input(200, minval=1, title="Length") src = input(close, title="Source") var bool show_hlines = input(true, "Show horizontal lines", input.bool) var bool show_emas = not show_hlines var color_entryema = color.green var color_fastema = color.orange var color

Label Horizontal EMA Lines (Variables)

为君一笑 提交于 2020-12-15 05:29:08
问题 This is the Code I use atm. (Thanks to Bjorn Mistiaen) len1 = input(10, minval=1, title="Length") len2 = input(21, minval=1, title="Length") len3 = input(55, minval=1, title="Length") len4 = input(100, minval=1, title="Length") len5 = input(200, minval=1, title="Length") src = input(close, title="Source") var bool show_hlines = input(true, "Show horizontal lines", input.bool) var bool show_emas = not show_hlines var color_entryema = color.green var color_fastema = color.orange var color

Tradingview Pine script plot staircase chart

拟墨画扇 提交于 2020-12-13 03:32:25
问题 I want to plot the quality of earnings which is not available in the trading view. However, what I got is not the staircase chart. How can I plot the staircase chart? I have tried the style option in plot function and gaps option in the financial function but no luck. study("Quality of earnings") CFO = financial(syminfo.tickerid, "CASH_F_OPERATING_ACTIVITIES", "FY") net = financial(syminfo.tickerid, "NET_INCOME", "FY") plot(CFO/net) 回答1: This will plot a stepline, overlaid on the main chart

Tradingview Pine script plot staircase chart

三世轮回 提交于 2020-12-13 03:31:11
问题 I want to plot the quality of earnings which is not available in the trading view. However, what I got is not the staircase chart. How can I plot the staircase chart? I have tried the style option in plot function and gaps option in the financial function but no luck. study("Quality of earnings") CFO = financial(syminfo.tickerid, "CASH_F_OPERATING_ACTIVITIES", "FY") net = financial(syminfo.tickerid, "NET_INCOME", "FY") plot(CFO/net) 回答1: This will plot a stepline, overlaid on the main chart

PineScript create a source with n Candles in future for forcasts in Tradingview

帅比萌擦擦* 提交于 2020-12-13 03:11:33
问题 in addition to my question in EMA for One Candle in Future I'm now trying to modify a source for some forecasts in Tradingview. In this modification I would like to modify the default series in that way, that I move every candle in the series N places into the past and overwrite the the places that were then vacated with the newest bar. See picture for better description I only need to do this on the current bar, as I want to plot the result with offset=n into the future. Current idea is

Pinescript set a position size

ぃ、小莉子 提交于 2020-12-01 12:56:00
问题 My strategy() is fully working but now I'm trying to manage how money is put in the trade. HERE'S MY CURRENT SITUATION : I have a SL set at the lowest low of the last 10 bars and a TP set at 1.5xSL. My strategy.exit : strategy.exit("EXIT LONG","LONG", stop=longSL, limit=longTP) Until here, everything is working fine. THE PROBLEM : Even though I use : strategy("TEST MACD DEFAULT", shorttitle="MACD", overlay=true, initial_capital=1000, default_qty_type=strategy.equity, default_qty_value=1,

Pinescript set a position size

为君一笑 提交于 2020-12-01 12:55:34
问题 My strategy() is fully working but now I'm trying to manage how money is put in the trade. HERE'S MY CURRENT SITUATION : I have a SL set at the lowest low of the last 10 bars and a TP set at 1.5xSL. My strategy.exit : strategy.exit("EXIT LONG","LONG", stop=longSL, limit=longTP) Until here, everything is working fine. THE PROBLEM : Even though I use : strategy("TEST MACD DEFAULT", shorttitle="MACD", overlay=true, initial_capital=1000, default_qty_type=strategy.equity, default_qty_value=1,

Pinescript set a position size

隐身守侯 提交于 2020-12-01 12:52:43
问题 My strategy() is fully working but now I'm trying to manage how money is put in the trade. HERE'S MY CURRENT SITUATION : I have a SL set at the lowest low of the last 10 bars and a TP set at 1.5xSL. My strategy.exit : strategy.exit("EXIT LONG","LONG", stop=longSL, limit=longTP) Until here, everything is working fine. THE PROBLEM : Even though I use : strategy("TEST MACD DEFAULT", shorttitle="MACD", overlay=true, initial_capital=1000, default_qty_type=strategy.equity, default_qty_value=1,

can't access value from function in pine editor

只谈情不闲聊 提交于 2020-11-29 19:10:36
问题 I am trying to test out an RSI-14 DI reversal strategy, but am unable to access the DI+ or DI- (variables are "plus" and "minus") from the function that they are in. Any ideas on how to access them? Here is the code: //@version=4 strategy("RSI-14, DI+, DI- Reversal Strategy", overlay=false) /// DI+ DI- Code /// /// DI+ is the variable called "plus" and DI- is the variable called "minus" adxlen = input(14, title="ADX Smoothing") dilen = input(14, title="DI Length") dirmov(len) => up = change