The following indicator should be placed as 3rd indicator below the chart in order to have the letter plots right – or edit the plots from “3” to the number you want it to be (OBJ_TEXT, 3 <- that one).
//+------------------------------------------------------------------+
//| Stochastic Combo.mq4 |
//| Copyright 2019, Macdulio |
//+------------------------------------------------------------------+
#property copyright "2019, Macdulio"
#property link "https://forexfore.blog"
#property description "Stochastic Combo"
#property strict
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_buffers 2
#property indicator_color1 LightSeaGreen
#property indicator_color2 Red
#property indicator_level1 20.0
#property indicator_level2 80.0
#property indicator_level3 35.0
#property indicator_level4 65.0
#property indicator_levelcolor clrBlack
#property indicator_levelstyle STYLE_DASH
extern double FSize=32;
double FMax = FSize*6/5;
double stoch[], stoch30[], RSI2[];
//---------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit(void)
{
string short_name;
//--- 2 additional buffers are used for counting.
IndicatorBuffers(2);
//--- indicator lines
SetIndexStyle(0,DRAW_LINE,EMPTY,5,indicator_color1);
SetIndexBuffer(0, stoch30);
SetIndexStyle(1,DRAW_LINE,EMPTY,4,indicator_color2);
SetIndexBuffer(1,stoch);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Stochastic oscillator |
//+------------------------------------------------------------------+
int start()
{
int i;
string symbol = Symbol();
ArrayResize(stoch, 600);
ArrayInitialize(stoch, EMPTY_VALUE);
ArrayResize(stoch30, 600);
ArrayInitialize(stoch30, EMPTY_VALUE);
ArrayResize(RSI2, 600);
ArrayInitialize(RSI2, EMPTY_VALUE);
deletetxt1("Jeat");
deletetxt1("Tit");
for(i=300; i>=0; i--){
stoch[i]=iStochastic(symbol,0,9,3,3,MODE_SMA,0,MODE_SIGNAL,i);
stoch30[i]=iStochastic(symbol,0,30,3,3,MODE_SMA,0,MODE_SIGNAL,i);
RSI2[i]= iRSI(symbol,0,2,PRICE_MEDIAN,i);
if ( (stoch30[i]>stoch[i] && stoch30[i+1]<=stoch[i+1] && stoch[i]>70) || (stoch[i]<80 && stoch[i+1]>80 && stoch30[i]>stoch[i]) || (stoch[i]>70 && stoch30[i]<35 ) ) {
ObjectCreate("Jeat"+DoubleToStr(i)+DoubleToStr(3), OBJ_ELLIPSE, 3, Time[i], stoch[i]+10, Time[i], stoch[i]);
ObjectSetInteger(0,"Jeat"+DoubleToStr(i)+DoubleToStr(3),OBJPROP_COLOR,clrOrangeRed);
ObjectSetDouble(0,"Jeat"+DoubleToStr(i)+DoubleToStr(3),OBJPROP_SCALE,.045);
ObjectSet("Jeat"+DoubleToStr(i)+DoubleToStr(3),OBJPROP_BACK,0);
ObjectSet("Jeat"+DoubleToStr(i)+DoubleToStr(3),OBJPROP_WIDTH,38);}
if ( (stoch30[i]<stoch[i] && stoch30[i+1]>=stoch[i+1] && stoch[i]<30) || (stoch[i]>20 && stoch[i+1]<20 && stoch30[i]<stoch[i] && stoch30[i]<10) || (stoch[i]<30 && stoch30[i]>70 && stoch[i+1]<30 && stoch30[i+1]>70) ) {
ObjectCreate("Jeat"+DoubleToStr(i)+DoubleToStr(3), OBJ_ELLIPSE, 3, Time[i], stoch[i]+10, Time[i], stoch[i]);
ObjectSetInteger(0,"Jeat"+DoubleToStr(i)+DoubleToStr(3),OBJPROP_COLOR,clrLimeGreen);
ObjectSetDouble(0,"Jeat"+DoubleToStr(i)+DoubleToStr(3),OBJPROP_SCALE,.045);
ObjectSet("Jeat"+DoubleToStr(i)+DoubleToStr(3),OBJPROP_BACK,0);
ObjectSet("Jeat"+DoubleToStr(i)+DoubleToStr(3),OBJPROP_WIDTH,38);}
if (Period()==60){
if (RSI2[i]<=RSI2[i+1] && RSI2[i+3]<RSI2[i+1] && RSI2[i+1]>81 && stoch[i+1]>68 && stoch30[i+1]>60){
if (Close[i]>iMA(NULL,0,828,0,MODE_EMA, PRICE_HIGH,i)+FMax*10*Point){ ObjectCreate("Tit"+DoubleToStr(i), OBJ_TEXT, 3, Time[i+1], 55); ObjectSetText("Tit"+DoubleToStr(i), "S/C", 22, "Arial Black", Gray);}
else {ObjectCreate("Tit"+DoubleToStr(i), OBJ_TEXT, 3, Time[i+1], 85); ObjectSetText("Tit"+DoubleToStr(i), "S", 32, "Arial Black", Maroon);}}
if (RSI2[i]>RSI2[i+1] && RSI2[i+2]>RSI2[i+1] && stoch[i]<30 && ((stoch30[i+1]<40 && RSI2[i+1]<9) || (Close[i+1]>iMA(NULL,0,30,0,MODE_SMA, PRICE_CLOSE,i+1)) && RSI2[i+1]<15 && (stoch30[i+1]<50 || stoch30[i+1]>60) )){
if (Close[i]<iMA(NULL,0,828,0,MODE_EMA, PRICE_LOW,i)-FMax*10*Point ) { ObjectCreate("Tit"+DoubleToStr(i), OBJ_TEXT, 3, Time[i+1], 55); ObjectSetText("Tit"+DoubleToStr(i), "B/C", 32, "Arial Black", Gray);}
else if (stoch[i]<35 && stoch[i+1]>stoch30[i+1]+12) { ObjectCreate("Tit"+DoubleToStr(i), OBJ_TEXT, 3, Time[i+1], 45); ObjectSetText("Tit"+DoubleToStr(i), "B", 32, "Arial Black", Maroon);}
else if (stoch[i+1]<stoch30[i+1]) { ObjectCreate("Tit"+DoubleToStr(i), OBJ_TEXT, 3, Time[i+1], 45); ObjectSetText("Tit"+DoubleToStr(i), "B", 32, "Arial Black", Maroon);}
if (RSI2[i]>RSI2[i+1] && RSI2[i+2]>RSI2[i+1] && stoch[i]<30 &&
stoch30[i]>70 && stoch30[i+1]>70 && stoch30[i+2]>70 && stoch30[i+3]>70 && stoch30[i+4]>70 && stoch30[i+5]>70 && stoch30[i+6]>70 && stoch30[i+7]>70 && stoch30[i+8]>70
&& RSI2[i+1]<15 ){
ObjectCreate("Tite"+DoubleToStr(i), OBJ_TEXT, 3, Time[i+3], 45);
ObjectSetText("Tite"+DoubleToStr(i), "EB", 32, "Arial Black", Blue);
}
}
}}
return(0);
}
//+------------------------------------------------------------------+
void deletetxt1(string what){
for(int iObj=ObjectsTotal()-1; iObj >= 0; iObj--){
string on = ObjectName(iObj);
if(StringFind(on, what) == 0) ObjectDelete(on);
} }
How do you trade corrective wave structures?
This is how you do it.
Plot this indicator on a 1H chart.
It would produce your lead signal.
Green Line above 80 = overbought
Green Line below 80 = oversold
You need the green line to be “fresh”, not embedded.
In the fresh overbought you are looking for a sell signal.
Now you need to make sure, that a turn is happening. Go to a 30-minute chart and look for a hood in the overbought and a root in the oversold.
These can be spotted with an RSI2 divergence (thick red short lines).
Now you start to count the humps to get the exit right.
Self explaining picture coming up:
The corrective wave structure does not show a continuation divergence between wave 2 and wave 4.
You are calculating the approximate distance of failure from the end of 3 wave (the peak that occurs right before the #4 print in the opposite direction) 1/2 fluctuation size away and factor in the possibility of a failed break as well.
Now you know a lot.
(TNR stands for Total Naked Risk in dollars).
I am planning on releasing a book on Managing Naked Risk in Forex in the coming years.