LUA-File-Download = download/file.php?id=6148
I have a request to make:
Differing from others I do not exactly value high and low candle wicks or "lines" a whole lot, to be perfectly honest. Therefore I showed you above how exactly the "Partial Candles"-LUA-Indicator looks in Candleworks Trading Station II. I set it to, mark my words, important: "OC", so only open and close prices are shown, therefore: there are no wicks / candle "lines" above or underneath the candles shown, you see. Now I want an indicator with "open close only candles" PLUS Heikin-Ashi standard, nothing fancy like HASM / HA Smoothed.
Request: Is it possible to make "HA Candles Open + Close only as in the LUA of "Partial Candles" with "OC" settings?
Code of "Partial Candles.lua" at your hand for your convenience, gentlemen
- Code: Select all
--+------------------------------------------------------------------+
--| Copyright © 2017, Gehtsoft USA LLC |
--| http://fxcodebase.com |
--+------------------------------------------------------------------+
--| Support our efforts by donating |
--| Paypal: https://goo.gl/9Rj74e |
--| BitCoin : 15VCJTLaz12Amr7adHSBtL9v8XomURo9RF |
--+------------------------------------------------------------------+
function Init()
indicator:name("Partial candles indicator");
indicator:description("Partial candles indicator");
indicator:requiredSource(core.Bar);
indicator:type(core.Indicator);
indicator:setTag("replaceSource", "t");
indicator.parameters:addGroup("Calculation");
indicator.parameters:addString("Type", "Type of candles", "", "OHLC");
indicator.parameters:addStringAlternative("Type", "OHLC", "", "OHLC");
indicator.parameters:addStringAlternative("Type", "OLC", "", "OLC");
indicator.parameters:addStringAlternative("Type", "OHC", "", "OHC");
indicator.parameters:addStringAlternative("Type", "OHL", "", "OHL");
indicator.parameters:addStringAlternative("Type", "HLC", "", "HLC");
indicator.parameters:addStringAlternative("Type", "HC", "", "HC");
indicator.parameters:addStringAlternative("Type", "LC", "", "LC");
indicator.parameters:addStringAlternative("Type", "OL", "", "OL");
indicator.parameters:addStringAlternative("Type", "OH", "", "OH");
indicator.parameters:addStringAlternative("Type", "OC", "", "OC");
indicator.parameters:addStringAlternative("Type", "C", "", "C");
indicator.parameters:addStringAlternative("Type", "O", "", "O");
end
local first;
local source = nil;
local Type;
function Prepare()
source = instance.source;
Type = instance.parameters.Type;
first = source:first();
local name = profile:id() .. "(" .. source:name() .. " " .. Type ..")";
instance:name(name);
open = instance:addInternalStream(first, 0);
close = instance:addInternalStream(first, 0);
high = instance:addInternalStream(first, 0);
low = instance:addInternalStream(first, 0);
instance:createCandleGroup("Partial candles", "", open, high, low, close);
end
function Update(period, mode)
if (period>first) then
if Type=="OHLC" then
open[period]=source.open[period];
close[period]=source.close[period];
high[period]=source.high[period];
low[period]=source.low[period];
elseif Type=="OLC" then
open[period]=source.open[period];
close[period]=source.close[period];
high[period]=math.max(open[period],close[period]);
low[period]=source.low[period];
elseif Type=="OHC" then
open[period]=source.open[period];
close[period]=source.close[period];
high[period]=source.high[period];
low[period]=math.min(open[period],close[period]);
elseif Type=="OHL" then
open[period]=source.open[period];
close[period]=open[period];
high[period]=source.high[period];
low[period]=source.low[period];
elseif Type=="HLC" then
close[period]=source.close[period];
open[period]=close[period];
high[period]=source.high[period];
low[period]=source.low[period];
elseif Type=="HC" then
close[period]=source.close[period];
open[period]=close[period];
high[period]=source.high[period];
low[period]=close[period];
elseif Type=="LC" then
close[period]=source.close[period];
open[period]=close[period];
high[period]=close[period];
low[period]=source.low[period];
elseif Type=="OL" then
open[period]=source.open[period];
close[period]=open[period];
high[period]=open[period];
low[period]=source.low[period];
elseif Type=="OH" then
open[period]=source.open[period];
close[period]=open[period];
high[period]=source.high[period];
low[period]=open[period];
elseif Type=="OC" then
open[period]=source.open[period];
close[period]=source.close[period];
high[period]=math.max(open[period],close[period]);
low[period]=math.min(open[period],close[period]);
elseif Type=="C" then
close[period]=source.close[period];
open[period]=close[period];
high[period]=close[period];
low[period]=close[period];
elseif Type=="O" then
open[period]=source.open[period];
close[period]=open[period];
high[period]=open[period];
low[period]=open[period];
end
end
end
/ In my book this is actually exactly the same as a renko chart. But, without further knowledge in coding lua indicators, maybe this way it is possible to implement a renko chart without another window necessary as function to serve exotic charts like renko but rather this way it could be possible to implement renko on *every* chart in Candleworks Trading Station II? Leaning myself out the window here, really not sure what to make of it, strikes me kind of odd how a coder would respond to this request. Your best guess? Possible / impossible?