OVERBOUGHT/OVERSOLD Indicator TMA channel

Viewing 15 posts - 1 through 15 (of 28 total)
  • Author
    Posts
  • #34878 quote
    RAAAMMY
    Participant
    Average

    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?

    #34896 quote
    RAAAMMY
    Participant
    Average

    The .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

    #34986 quote
    StantonR
    Participant
    Senior

    Hi Raaammy

    What are the rules for the indicator else you could use a simple RSI indicator to check overbought or oversold conditions.

    Or if you could extract the code from the .lua file we can try duplicate it.

    #34987 quote
    StantonR
    Participant
    Senior

    Found This on the site.

    TMA center channel bands

    #34990 quote
    Nicolas
    Keymaster
    Master

    Original TMA is a repainting indicator because it uses the future next candlestick to calculate. The one posted into the Library doesn’t repaint.

    #34994 quote
    RAAAMMY
    Participant
    Average

    I downloaded the file, but when I attached it to the chart, instead of being displayed over the price, it was in a separate box along the bottom of the chart – which is useless!

    #34996 quote
    StantonR
    Participant
    Senior

    Hi 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.

    https://www.youtube.com/watch?v=V5-h_xzEd1A

    #34997 quote
    Madrosat
    Participant
    Master

    Hello

    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 then

    Slope: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
    end

    function Update(period, mode)

    ATR:update(mode);

    if period < ATR.DATA:first() then
    return;
    end

    if period < TMA_Period then
    return;
    end

    if period == source:size()-2 then
    for i = first, period , 1 do
    Logic(i, mode);
    end
    elseif period == source:size()-1 then
    Logic(period, mode);
    end

    end
    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);
    end

    end
    end

    #35018 quote
    Nicolas
    Keymaster
    Master

    @Madrosat

    In 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.

    #35057 quote
    RAAAMMY
    Participant
    Average

    Thanks 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.

    TMA-and-OBOS.png TMA-and-OBOS.png
    #35061 quote
    RAAAMMY
    Participant
    Average

    I have tried to find the code for this OBOS and the FX Codebase refers me to the attached chart and code.

    2017-05-10_1333.png 2017-05-10_1333.png 2017-05-10_1333_001.png 2017-05-10_1333_001.png
    #35095 quote
    Nicolas
    Keymaster
    Master

    I 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:

    // parameters
    HalfLength = 56
    AtrLength = 100
    AtrMultiplier = 3.9
    
    avg = average[1](close)
    
    sum = (HalfLength+1)*avg
    sumw = (HalfLength+1)
    k = HalfLength
    
    for j = 1 to HalfLength do
    k = k-1
    sum = sum+(k*avg[j])
    sumw = sumw+k
    next
    
    buffer1 = sum/sumw
    
    myrange = AverageTrueRange[AtrLength](close)*AtrMultiplier
    
    buffer2 = buffer1+myrange
    buffer3 = buffer1-myrange
    
    RETURN 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.

    tma-channel-center-1-minute.png tma-channel-center-1-minute.png
    #35100 quote
    RAAAMMY
    Participant
    Average

    Hi 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

    #35145 quote
    Madrosat
    Participant
    Master

    Hello Nicolas

    I do’nt know if they are strategies with repaint indicator and  if  it  is possible ??

    But for me I have not

    Thanks

    #35170 quote
    Nicolas
    Keymaster
    Master

    @RAAAMMY

    Good 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 🙂


    @Madrosat

    It’s not possible to launch realtime trading strategies with repaint indicator into ProOrder (with DPO or zigzag for instance).

Viewing 15 posts - 1 through 15 (of 28 total)
  • You must be logged in to reply to this topic.

OVERBOUGHT/OVERSOLD Indicator TMA channel


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
RAAAMMY @raaammy Participant
Summary

This topic contains 27 replies,
has 6 voices, and was last updated by Nicolas
5 years, 8 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 05/09/2017
Status: Active
Attachments: 8 files
Logo Logo
Loading...