Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Profile: ez2000
About
User Name: ez2000
Groups: Gold User, Member, Platinum User, TeleChart
Rank: Registered User
Real Name:
Location
Occupation:
Interests:
Gender: Gender:
Statistics
Joined: Saturday, March 29, 2014
Last Visit: Monday, February 22, 2016 10:16:50 PM
Number of Posts: 1
[0.00% of all post / 0.00 posts per day]
Avatar
Last 10 Posts
Topic: Help convert TQI Amibroker formula to PCF
Posted: Wednesday, April 2, 2014 8:21:15 PM

Hi I am doing a platinum trial of TQ2000 and so far I find it a very good charting platform but there is one stumbling block that is preventing me from migrating away from AMIBROKER and that is this formula.

Can somebody help me convert this amibroker formula to pcf?

 

_SECTION_BEGIN("");
// Piecewise EMA is an EMA that restarts calculations each time
// the 'sincebar' argument is true
function PiecewiseEMA( array, range, sincebar )
{
  factor = IIf( sincebar, 1, 2/(range+1) );
  return AMA2( array, factor, 1-factor );
}
// parameters
m=4;
n=250;
// generate reversal signals based on EMA crossover rule
Lpf1 = EMA( C, 7  );
Lpf2 = EMA( C, 15 );
CrossPoint = Cross( Lpf1, Lpf2 ) OR Cross( Lpf2, Lpf1 );
Periods = BarsSince( CrossPoint );
// variable bar sum
DC = Close - Ref( Close, -1 );
CPC = Sum( DC, Periods );
// smooth CPC by piecewise 4 bar EMA
Trend = PiecewiseEMA( CPC, 4, CrossPoint );
// noise
DT = CPC - Trend;
Noise = 2 * sqrt( MA( DT^2, n ) );
// alternative 'linear' noise calculation
// Noise = 2 * MA( abs( DT ), n ) );
QIndicator = Trend/Noise;
Plot( Qindicator, "Qindicator", ParamColor( "Color", colorCycle ), styleHistogram, ParamStyle("Style") );
 
PlotGrid( 0, colorBlack );
 
_SECTION_END();