New to MQL and would like help to transfer some esignal custom studies

 
I have two studies I would like to convert from esignalto mql. I have attached the syntax for both. They may well exist already but Iam unable to find them. Any help would be very much appreciated. Thanks!
 
traderboy:
I have two studies I would like to convert from esignalto mql. I have attached the syntax for both. They may well exist already but Iam unable to find them. Any help would be very much appreciated. Thanks!
Here is the other study!
 
traderboy:
I have two studies I would like to convert from esignalto mql. I have attached the syntax for both. They may well exist already but Iam unable to find them. Any help would be very much appreciated. Thanks!

////DivergenceBar/////


//{{EFSWizard_Declarations
var vLastAlert = -1;
//}}EFSWizard_Declarations


function preMain() {
//{{EFSWizard_Code_PreMain_setPriceBarColor
setColorPriceBars(true);
//}}EFSWizard_Code_PreMain_setPriceBarColor
/**
* This function is called only once, before any of the bars are loaded.
* Place any study or EFS configuration commands here.
*/
//{{EFSWizard_PreMain
setPriceStudy(true);
setStudyTitle("");
//}}EFSWizard_PreMain

}

function main() {
/**
* The main() function is called once per bar on all previous bars, once per
* each incoming completed bar, and if you don't have 'setComputeOnClose(true)'
* in your preMain(), it is also called on every tick.
*/

//{{EFSWizard_Expressions
//{{EFSWizard_Expression_1
if (
high() > high(-1) &&
close() < open()
) onAction1()
//}}EFSWizard_Expression_1

//{{EFSWizard_Expression_2
else if (
low() < low(-1) &&
close() > open()
) onAction2()
//}}EFSWizard_Expression_2

//{{EFSWizard_Expression_3
else if (
Strategy.isInTrade() == Strategy. isInTrade()
) onAction3();
//}}EFSWizard_Expression_3

//}}EFSWizard_Expressions


//{{EFSWizard_Return
return null;
//}}EFSWizard_Return

}

function postMain() {
/**
* The postMain() function is called only once, when the EFS is no longer used for
* the current symbol (ie, symbol change, chart closing, or application shutdown).
*/
}

//{{EFSWizard_Actions
//{{EFSWizard_Action_1
function onAction1() {
if (vLastAlert != 1) Strategy.doShort("", Strategy. CLOSE, Strategy. THISBAR, Strategy.DEFAULT, 0);
setPriceBarColor(Color.RGB(255,0,0));
vLastAlert = 1;
}
//}}EFSWizard_Action_1

//{{EFSWizard_Action_2
function onAction2() {
if (vLastAlert != 2) Strategy.doLong("", Strategy. CLOSE, Strategy. THISBAR, Strategy.DEFAULT, 0);
setPriceBarColor(Color.RGB(0,0,255));
vLastAlert = 2;
}
//}}EFSWizard_Action_2

//{{EFSWizard_Action_3
function onAction3() {
setPriceBarColor(Color.RGB(0,0,0));
vLastAlert = 3;
}
//}}EFSWizard_Action_3

//}}EFSWizard_Actions

//////////

/////////DisparityIndex/////////

var vMA = null;

function preMain() {
setPriceStudy(false);
setStudyTitle("Disparity");
setCursorLabelName("Disparity", 0);
setDefaultBarFgColor(Color.blue, 0);
setDefaultBarThickness(1,0);


var fp1 = new FunctionParameter("Length", FunctionParameter. NUMBER);
fp1.setLowerLimit(1);
fp1.setDefault(20); //Edit this value to set a new default

var fp2 = new FunctionParameter("Offset", FunctionParameter.NUMBER);
fp2.setDefault(0); //Edit this value to set a new default

var fp3 = new FunctionParameter("Source", FunctionParameter.STRING);
fp3.setName("Source");
fp3.addOption("Close");
fp3.addOption("High");
fp3.addOption("Low");
fp3.addOption("Open");
fp3.addOption("HL/2");
fp3.addOption("HLC/3");
fp3.addOption("OHLC/4");
fp3.setDefault("Close"); //Edit this value to set a new default

var fp4 = new FunctionParameter("Type", FunctionParameter.STRING);
fp4.setName("Type");
fp4.addOption("MAStudy.SIMPLE");
fp4.addOption("MAStudy.EXPONENTIAL");
fp4.addOption("MAStudy.WEIGHTED");
fp4.addOption("MAStudy.VOLUMEWEIGHTED");
fp4.setDefault("MAStudy.SIMPLE"); //Edit this value to set a new default


}

function main(Length,Offset,Source,Type) {

if (vMA == null) vMA = new MAStudy(Length, Offset, Source, eval(Type));

/*****************************************
Insert your code following this text block
Use vMA.getValue(MAStudy.MA) for your code
******************************************/

if(vMA.getValue(MAStudy.MA)==null)
return;

var vDiff = ((close()-vMA.getValue(MAStudy.MA))/vMA.getValue(MAStudy.MA))*100;
addBand(0,PS_SOLID,1,Color.black,2);


return vDiff;
}

 

OK excuse me writing again! I have found the disparity index file. I just need help with the divergence bar file to color the price bar when the following criteria is met:

if
high() > high(-1) &&
close() < open()
set price bar color to red
else if (
low() < low(-1) &&
close() > open()
set price bar color to blue

else color bar black

Reason: