OVERBOUGHT/OVERSOLD Indicator TMA channel
Forums › ProRealTime English forum › ProBuilder support › OVERBOUGHT/OVERSOLD Indicator TMA channel
- This topic has 27 replies, 6 voices, and was last updated 4 years ago by Nicolas.
Tagged: Awesome Oscillator, channel, scalping, TMA
-
-
05/09/2017 at 7:27 AM #34878
I have just moved to ProReal from FXCM and they had a great OBOS (overbought/Oversold Indicator) which is a .lua file
I have seen this same indicator on MT4, but not as good as the .lua file
Has anyone got the indicator or code for this indicator in ProReal?
05/09/2017 at 9:33 AM #34896The .lua indicator is available from fxcodebase.com
here is the link –
http://www.fxcodebase.com/code/viewtopic.php?f=17&t=59406&hilit=extreme+tma+indicator
05/09/2017 at 8:15 PM #3498605/09/2017 at 8:25 PM #34987Found This on the site.
https://www.prorealcode.com/prorealtime-indicators/tma-center-channel-bands/
05/09/2017 at 8:45 PM #3499005/09/2017 at 10:49 PM #3499405/10/2017 at 2:46 AM #34996Hi Raaammy
On the Price chart click the wrench next to the word “Price” then click add indicator. This will overlay the indicator over the price.
Below is a video I made on how to use PRT charts.
05/10/2017 at 5:34 AM #34997Hello
Here the code .lua is this code repainting ???
or is only the tma code whos is repainting ??
–+——————————————————————+
–| Copyright © 2016, Gehtsoft USA LLC |
–| http://fxcodebase.com |
–| Support our efforts by donating |
–| Paypal: https://goo.gl/9Rj74e |
–+——————————————————————+
–| Developed by : Mario Jemic |
–| mario.jemic@gmail.com |
–| BitCoin : 15VCJTLaz12Amr7adHSBtL9v8XomURo9RF |
–+——————————————————————+function Init()
indicator:name(“Extreme TMA line Slope indicator”);
indicator:description(“Extreme TMA line Slope indicator”);
indicator:requiredSource(core.Tick);
indicator:type(core.Oscillator);indicator.parameters:addGroup(“Calculation”);
indicator.parameters:addInteger(“TMA_Period”, “TMA period”, “”, 56);
indicator.parameters:addInteger(“ATR_Period”, “ATR period”, “”, 100);
indicator.parameters:addDouble(“TrendThreshold”, “TrendThreshold”, “”, 0.5);
indicator.parameters:addBoolean(“Redraw”, “Redraw”, “”, true);
indicator.parameters:addBoolean(“Show”, “Show Threshol Level”, “”, true);indicator.parameters:addGroup(“Style”);
indicator.parameters:addColor(“TMA_NEclr”, “Slop Line neutral Color”, “Neutral Color”, core.rgb(128, 128, 128));
indicator.parameters:addColor(“TMA_UPclr”, “Slop Line UP Color”, “UP Color”, core.rgb(0, 255, 0));
indicator.parameters:addColor(“TMA_DNclr”, “Slop Line DN Color”, “DN Color”, core.rgb(255, 0, 0));
indicator.parameters:addInteger(“TMAwidth”, “Width”, “Width”, 2, 1, 5);
indicator.parameters:addInteger(“TMAstyle”, “Style”, “Style”, core.LINE_SOLID);
indicator.parameters:setFlag(“TMAstyle”, core.FLAG_LINE_STYLE);indicator.parameters:addGroup(“OB/OS Levels”);
indicator.parameters:addColor(“level_overboughtsold_color”, “Line Color”,””, core.rgb(128, 128, 128));
indicator.parameters:addInteger(“level_overboughtsold_width”,”Line width”,””, 1, 1, 5);
indicator.parameters:addInteger(“level_overboughtsold_style”, “Line Style”,””, core.LINE_SOLID);
indicator.parameters:setFlag(“level_overboughtsold_style”, core.FLAG_LEVEL_STYLE);end
local first;
local source = nil;
local TMA_Period;
local ATR_Period;
local ATR_Mult;
local TrendThreshold;
local Redraw;
local TMA=nil;
local ATR;
local Slope;local Show;
function Prepare()
source = instance.source;
TMA_Period=instance.parameters.TMA_Period;
ATR_Period=instance.parameters.ATR_Period;
TrendThreshold=instance.parameters.TrendThreshold;
Show=instance.parameters.Show;
Redraw=instance.parameters.Redraw;assert(core.indicators:findIndicator(“TATR”) ~= nil, “Please, download and install TATR.LUA indicator”);
ATR=core.indicators:create(“TATR”, source, ATR_Period);first = math.max(source:first() ,ATR.DATA:first(),2*TMA_Period);
local name = profile:id() .. “(” .. source:name() .. “, ” .. instance.parameters.TMA_Period .. “, ” .. instance.parameters.ATR_Period .. “, ” .. instance.parameters.TrendThreshold .. “)”;
instance:name(name);TMA= instance:addInternalStream(0, 0);
Slope = instance:addStream(“Slope”, core.Line, name .. “.Slope”, “Slope”, instance.parameters.TMA_NEclr, first+TMA_Period);
Slope:setWidth(instance.parameters.TMAwidth);
Slope:setStyle(instance.parameters.TMAstyle);
if Show thenSlope:addLevel(instance.parameters.TrendThreshold, instance.parameters.level_overboughtsold_style, instance.parameters.level_overboughtsold_width, instance.parameters.level_overboughtsold_color);
Slope:addLevel(-instance.parameters.TrendThreshold, instance.parameters.level_overboughtsold_style, instance.parameters.level_overboughtsold_width, instance.parameters.level_overboughtsold_color);end
endfunction Update(period, mode)
ATR:update(mode);
if period < ATR.DATA:first() then
return;
endif period < TMA_Period then
return;
endif period == source:size()-2 then
for i = first, period , 1 do
Logic(i, mode);
end
elseif period == source:size()-1 then
Logic(period, mode);
endend
function Logic (period, mode)local i;
local ii=TMA_Period;
local LastPeriod;
if period==source:size()-1 then
LastPeriod=true;
else
LastPeriod=false;
end
while ii>0 do
if not(LastPeriod) then
ii=0;
else
ii=ii-1;
end
local Sum=0;
local SumW=(TMA_Period+2)*(TMA_Period+1)/2;
for i=0,TMA_Period,1 do
Sum=Sum+(TMA_Period-i+1)*source[period-i];
if Redraw then
if i<=source:size()-1-period and i>0 then
Sum=Sum+(TMA_Period-i+1)*source[period+i];
SumW=SumW+(TMA_Period-i+1);
end
end
end
TMA[period]=Sum/SumW;
Slope[period]=(TMA[period]-TMA[period-1])/(0.1*ATR.DATA[period]);if Slope[period]>TrendThreshold then
Slope:setColor(period,instance.parameters.TMA_UPclr);
elseif Slope[period]<-TrendThreshold then
Slope:setColor(period,instance.parameters.TMA_DNclr);
else
Slope:setColor(period,instance.parameters.TMA_NEclr);
endend
end05/10/2017 at 9:53 AM #35018In this LUA version, you can choose if you want the indicator to redraw or not, when it is true, the calculation differs and take into consideration the next candlestick which is not known of course in real time. So, because of the global loop over the whole price history, the repaint behavior doesn’t mind in the past, but it is quite annoying when you are trading it live.
Also the code you shared is the “slope” indicator, not the overbought/oversold channel one that RAAAMMY mentioned previously.
05/10/2017 at 1:15 PM #35057Thanks everyone for their comments.
Here is a chart (FXCM Trading Station) showing the TMA with the ATR Multiplier set to 3.9, Trend threshold 0.5, and TMA period 56.
The top OBOS is set to 3, and the bottom OBOS is set to 9.
The yellow dashed line is a 35 EMA.
This is the charts I had with FXCM and want to replicate with ProReal.
05/10/2017 at 1:38 PM #3506105/10/2017 at 5:01 PM #35095I took the code from the TMA channel we already have in the library and changed the variables settings accordingly to your needs, this is the code:
12345678910111213141516171819202122232425// parametersHalfLength = 56AtrLength = 100AtrMultiplier = 3.9avg = average[1](close)sum = (HalfLength+1)*avgsumw = (HalfLength+1)k = HalfLengthfor j = 1 to HalfLength dok = k-1sum = sum+(k*avg[j])sumw = sumw+knextbuffer1 = sum/sumwmyrange = AverageTrueRange[AtrLength](close)*AtrMultiplierbuffer2 = buffer1+myrangebuffer3 = buffer1-myrangeRETURN buffer1 coloured(0,220,0) as "TMA", buffer2 coloured(220,0,0) as "upper band", buffer3 coloured(0,220,0) as "lower band"Of course, it WILL NEVER be as smooth and as accurate like your example, because this indicator DOES NOT REPAINT THE PAST. I think I could change its behavior to repaint, but do you really want it?
About the OBOS indicator, would be please copy/paste the code here instead of a picture? It would be easier for me to translate it to PRT, thank you.
05/10/2017 at 5:12 PM #35100Hi Nicholas,
Thanks for your help.
As for the OBOS, I had a look in the indicators section, and after changing the settings (quite a few times), I found the AFL Winner Oscillator is about as good as I can get.
All the best.
RAAAMMY
05/11/2017 at 6:29 AM #3514505/11/2017 at 9:34 AM #35170Good to know you found what you want in the code library section. I’m sure a lot of people would be glad to know how you are using these 2 indicators into your own trading, would you be kind enough to tell us more about it? Many thanks 🙂
It’s not possible to launch realtime trading strategies with repaint indicator into ProOrder (with DPO or zigzag for instance).
-
AuthorPosts