//+------------------------------------------------------------------+ //| FX_Power_code_snippets.mq4 | //| Copyright 2019, SteinInvestments | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2019, Stein Investments" #property link "https://www.mql5.com/users/blueball" #property version "1.00" #property strict string first,second; int firstbuff,secondbuff; double V1,V2,Delta; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- // FX Power code snippets //IMPORTANT INFORMATION FOR STRATEGY TESTER USAGE in Metatrader 4 //If you like to use FX Power at the strategy tester you have to take care that //the entire history data of ALL 28 Symbols is available at "\\tester\history" //If parts of this data are missing you'll get wrong strength calculation results //No action at MT5 -> The Metatrader 5 downloads all necessary data automatically //Read and divide the underlying symbol first=StringSubstr(Symbol(),0,3); second=StringSubstr(Symbol(),3,3); //Buffer allocation table if(first == "USD") firstbuff = 0; if(first == "CAD") firstbuff = 1; if(first == "GBP") firstbuff = 2; if(first == "EUR") firstbuff = 3; if(first == "CHF") firstbuff = 4; if(first == "JPY") firstbuff = 5; if(first == "AUD") firstbuff = 6; if(first == "NZD") firstbuff = 7; if(second == "USD") secondbuff = 0; if(second == "CAD") secondbuff = 1; if(second == "GBP") secondbuff = 2; if(second == "EUR") secondbuff = 3; if(second == "CHF") secondbuff = 4; if(second == "JPY") secondbuff = 5; if(second == "AUD") secondbuff = 6; if(second == "NZD") secondbuff = 7; /* //Read the strength values for the underlying symbol V1 = iCustom(Symbol(),0,"Market\\FX Power",firstbuff,0); V2 = iCustom(Symbol(),0,"Market\\FX Power",secondbuff,0); //Read the strength values for the underlying symbol //of the 10th selectable time period in the FX Power dropdown list V1 = iCustom(Symbol(),0,"Market\\FX Power","",10,firstbuff,0); V2 = iCustom(Symbol(),0,"Market\\FX Power","",10,secondbuff,0); */ //Deactivate the FX Power panel to save computing resources V1 = iCustom(Symbol(),PERIOD_M15,"Market\\FX Power","",8,"",true,firstbuff,1); V2 = iCustom(Symbol(),PERIOD_M15,"Market\\FX Power","",8,"",true,secondbuff,1); Delta = NormalizeDouble(MathAbs(V1-V2),1); //or Delta = iCustom(Symbol(),0,"Market\\FX Power",8,0); Comment(" V1: ",V1," V2: ",V2," Delta: ",Delta); } //+------------------------------------------------------------------+