I am a beginner programmer and I am confused
How do I convert this FastD(NS1) <= SlowD(NS2) to MQL4?
/*
{ Entry and exit conditions }
EntCondL = true;
EntCondS = FastD(NS1) <= SlowD(NS2);
EndofSess = false;
If DataCompression >= 1 and DataCompression <= 4 then
EndofSess = time = SessionEndTime(0, 1);
*/
FastD (Function)
Disclaimer
The FastD series function returns the Fast D value for the Stochastic
oscillator.
Syntax
FastD(StochLength)
Returns (Double)
A numeric value containing FastD for the current bar.
Parameters
Name
Type
Description
StochLength
Numeric
Sets the number of bars to consider.
Remarks
Please refer to the discussion under the Stochastic function.
Example
Assigns to Value1 the Stochastic FastD over 14 bars.
Value1 = FastD(14);
Reference
Takano, Mike. Stochastic Oscillator, Technical Analysis of Stocks and
Commodities. April 1991.
Stein, John. The Traders’ Guide to Technical Indicators, Futures
Magazine. August 1990.
SlowD (Function)
Disclaimer
The SlowD series function returns the slow D value for the Stochastic
oscillator.
Syntax
SlowD(StochLength)
Returns (Double)
A numeric value containing SlowD for the current bar.
Parameters
Name
Type
Description
StochLength
Numeric
Sets the number of bars to consider.
Remarks
Please refer to the discussion under the Stochastic function.
Example
Assigns to Value1 the Stochastic SlowD over 14 bars.
Value1 = SlowD(14);
Reference
Takano, Mike. Stochastic Oscillator, Technical Analysis of Stocks and
Commodities. April 1991.
Stein, John. The Traders’ Guide to Technical Indicators, Futures
Magazine. August 1990.
in MQL4
double iStochastic( string symbol, int timeframe, int %Kperiod, int
%Dperiod, int slowing, int method, int price_field, int mode, int
shift)
Calculates the Stochastic oscillator and returns its value.
Parameters:symbol - Symbol the data of which should be used to
calculate indicator. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration
values. 0 means the current chart timeframe.
%Kperiod - %K line period.
%Dperiod - %D line period.
slowing - Slowing value.
method - MA method. It can be any ofMoving Average method
enumeration value.
price_field - Price field parameter. Can be one of this values: 0
- Low/High or 1 - Close/Close.
mode - Indicator line index. It can be any of the Indicators line
identifiers enumeration value.
shift - Index of the value taken from the indicator buffer (shift
relative to the current bar the given amount of periods ago).
Sample:
if(iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_MAIN,0)>iStochastic(NULL,
0,5,3,3,MODE_SMA,0,MODE_SIGNAL,0))
return(0);
How do I convert this FastD(NS1) <= SlowD(NS2) to MQL4?
/*
{ Entry and exit conditions }
EntCondL = true;
EntCondS = FastD(NS1) <= SlowD(NS2);
EndofSess = false;
If DataCompression >= 1 and DataCompression <= 4 then
EndofSess = time = SessionEndTime(0, 1);
*/
FastD (Function)
Disclaimer
The FastD series function returns the Fast D value for the Stochastic
oscillator.
Syntax
FastD(StochLength)
Returns (Double)
A numeric value containing FastD for the current bar.
Parameters
Name
Type
Description
StochLength
Numeric
Sets the number of bars to consider.
Remarks
Please refer to the discussion under the Stochastic function.
Example
Assigns to Value1 the Stochastic FastD over 14 bars.
Value1 = FastD(14);
Reference
Takano, Mike. Stochastic Oscillator, Technical Analysis of Stocks and
Commodities. April 1991.
Stein, John. The Traders’ Guide to Technical Indicators, Futures
Magazine. August 1990.
SlowD (Function)
Disclaimer
The SlowD series function returns the slow D value for the Stochastic
oscillator.
Syntax
SlowD(StochLength)
Returns (Double)
A numeric value containing SlowD for the current bar.
Parameters
Name
Type
Description
StochLength
Numeric
Sets the number of bars to consider.
Remarks
Please refer to the discussion under the Stochastic function.
Example
Assigns to Value1 the Stochastic SlowD over 14 bars.
Value1 = SlowD(14);
Reference
Takano, Mike. Stochastic Oscillator, Technical Analysis of Stocks and
Commodities. April 1991.
Stein, John. The Traders’ Guide to Technical Indicators, Futures
Magazine. August 1990.
in MQL4
double iStochastic( string symbol, int timeframe, int %Kperiod, int
%Dperiod, int slowing, int method, int price_field, int mode, int
shift)
Calculates the Stochastic oscillator and returns its value.
Parameters:symbol - Symbol the data of which should be used to
calculate indicator. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration
values. 0 means the current chart timeframe.
%Kperiod - %K line period.
%Dperiod - %D line period.
slowing - Slowing value.
method - MA method. It can be any ofMoving Average method
enumeration value.
price_field - Price field parameter. Can be one of this values: 0
- Low/High or 1 - Close/Close.
mode - Indicator line index. It can be any of the Indicators line
identifiers enumeration value.
shift - Index of the value taken from the indicator buffer (shift
relative to the current bar the given amount of periods ago).
Sample:
if(iStochastic(NULL,0,5,3,3,MODE_SMA,0,MODE_MAIN,0)>iStochastic(NULL,
0,5,3,3,MODE_SMA,0,MODE_SIGNAL,0))
return(0);