Logarithmic regression strategy

Strategies are published here.

Moderator: admin

Logarithmic regression strategy

Postby Alexander.Gettinger » Wed Apr 27, 2011 11:59 pm

Strategy based on Logarithmic regression indicator (viewtopic.php?f=17&t=3716).

BUY condition: price exceeds upper line by [Distance] number of pips.
SELL condition: price exceeds bottom line by [Distance] number of pips.

Download:
LogarithmicRegression_Strategy.lua
(12.94 KiB) Downloaded 1419 times


For this strategy must be installed Logarithmic regression indicator (viewtopic.php?f=17&t=3716).

The Strategy was revised and updated on November 19, 2018.
Attachments
2018-11-19_15-00-33.png
2018-11-19_15-00-44.png
Alexander.Gettinger
FXCodeBase: Confirmed User
 
Posts: 3785
Joined: Wed Mar 31, 2010 9:40 pm
Location: Russia, Omsk

Re: Logarithmic regression strategy

Postby Exolon » Fri Jul 08, 2011 8:40 am

Backtesting this on EUR/USD, H1 caused an infinite loop (or at least hung Marketscope/FTS for about two minutes until I killed the whole thing). I'm not sure how, since there only seems to be one loop in the program, unless "enum:next()" doesn't actually advance the enumerator?
Exolon
 
Posts: 31
Joined: Thu Jul 07, 2011 5:39 pm
Location: Ireland

Re: Logarithmic regression strategy

Postby Exolon » Fri Jul 29, 2011 10:00 am

Just a quick note; I was trying to debug this strategy and the size was a bit overwhelming. Every line of code we don't write is by definition correct, and makes the program easier to debug. :)

So the following long if/else construct in the strategy...
Code: Select all
    Price=instance.parameters.Price;
    if Price=="close" then
     LR = core.indicators:create("LOGARITHMIC_REGRESSION", Source.close, instance.parameters.Period, instance.parameters.Deviation);
    elseif Price=="open" then
     LR = core.indicators:create("LOGARITHMIC_REGRESSION", Source.open, instance.parameters.Period, instance.parameters.Deviation);
    elseif Price=="high" then
     LR = core.indicators:create("LOGARITHMIC_REGRESSION", Source.high, instance.parameters.Period, instance.parameters.Deviation);
    elseif Price=="low" then
     LR = core.indicators:create("LOGARITHMIC_REGRESSION", Source.low, instance.parameters.Period, instance.parameters.Deviation);
    elseif Price=="typical" then
     LR = core.indicators:create("LOGARITHMIC_REGRESSION", Source.typical, instance.parameters.Period, instance.parameters.Deviation);
    elseif Price=="median" then
     LR = core.indicators:create("LOGARITHMIC_REGRESSION", Source.median, instance.parameters.Period, instance.parameters.Deviation);
    else
     LR = core.indicators:create("LOGARITHMIC_REGRESSION", Source.weighted, instance.parameters.Period, instance.parameters.Deviation);
    end

...is functionally equivalent to this much shorter code:
Code: Select all
    Price = instance.parameters.Price or 'weighted'
    LR = core.indicators:create("LOGARITHMIC_REGRESSION", Source[Price], instance.parameters.Period, instance.parameters.Deviation)
Exolon
 
Posts: 31
Joined: Thu Jul 07, 2011 5:39 pm
Location: Ireland



Return to Custom Strategies

Who is online

Users browsing this forum: No registered users and 13 guests