Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
SSL_sBar_KaleOrg_sw_mtf
//+------------------------------------------------------------------+
//| SSL.mq4 |
//|ssl bar sw mtf Kalenzo |
//| bartlomiej.gorski@gmail.com |
//+------------------------------------------------------------------+
//2008fxtsd ki
#property copyright "Kalenzo"
#property link "bartlomiej.gorski@gmail.com"
#property indicator_buffers 2
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_minimum 10
#property indicator_maximum 90
extern int Lb = 10;
extern int SSL_BarLevel = 15; //BarLevel 10-90
extern int BarsSize = 2; //0-5
extern int TimeFrame=0;
extern string TimeFrames = "M1;5,15,30,60H1;240H4;1440D1;10080W1;43200MN|0-CurrentTF";
string IndicatorFileName;
double ssl[],Hld,Hlv, sslHup[],sslHdn[],PriceBuff[];
#property indicator_separate_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(3);
SetIndexBuffer (0,sslHup);
SetIndexArrow (0,167);
SetIndexLabel (0,"SSLup "+Lb+"["+TimeFrame+"]");
SetIndexBuffer (1,sslHdn);
SetIndexArrow (1,167);
SetIndexLabel (1,"SSLdn "+Lb+"["+TimeFrame+"]");
SetIndexBuffer (2,ssl);
SetIndexLabel (2,"");
SetIndexStyle(0,DRAW_ARROW,0,BarsSize);
SetIndexStyle(1,DRAW_ARROW,0,BarsSize);
SetIndexStyle(2,DRAW_NONE);
SetIndexEmptyValue(0,EMPTY_VALUE);
SetIndexEmptyValue(1,EMPTY_VALUE);
switch(TimeFrame)
{
case 1 : string TimeFrameStr= "M1"; break;
case 5 : TimeFrameStr= "M5"; break;
case 15 : TimeFrameStr= "M15"; break;
case 30 : TimeFrameStr= "M30"; break;
case 60 : TimeFrameStr= "H1"; break;
case 240 : TimeFrameStr= "H4"; break;
case 1440 : TimeFrameStr= "D1"; break;
case 10080 : TimeFrameStr= "W1"; break;
case 43200 : TimeFrameStr= "MN1"; break;
default : TimeFrameStr= "TF0";
}
IndicatorShortName("SSL "+Lb+"["+TimeFrameStr+"]");
IndicatorFileName = WindowExpertName();
if (TimeFrame<Period()) TimeFrame=Period();
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int i,limit;
if (counted_bars<0) return(-1);
if (counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
if (TimeFrame != Period())
{
datetime TimeArray[];
limit = MathMax(limit,TimeFrame/Period());
ArrayCopySeries(TimeArray ,MODE_TIME ,NULL,TimeFrame);
for(i=0,int y=0; i<limit; i++)
{
if(Time[i]<TimeArray[y]) y++;
sslHup[i] = iCustom(NULL,TimeFrame,IndicatorFileName,Lb,SSL_BarLevel,BarsSize,0,y);
sslHdn[i] = iCustom(NULL,TimeFrame,IndicatorFileName,Lb,SSL_BarLevel,BarsSize,1,y);
}
return(0);
}
for(i=Bars-Lb;i>=0;i--)
{
if(Close[i]>iMA(Symbol(),TimeFrame,Lb,0,MODE_SMA,PRICE_HIGH,i+1))
Hld = 1;
else
{
if(Close[i]<iMA(Symbol(),TimeFrame,Lb,0,MODE_SMA,PRICE_LOW,i+1))
Hld = -1;
else
Hld = 0;
}
if(Hld!=0)
Hlv = Hld;
if(Hlv == -1)
{
ssl[i] = iMA(Symbol(),TimeFrame,Lb,0,MODE_SMA,PRICE_HIGH,i+1);
sslHdn[i] = SSL_BarLevel; sslHup[i]=EMPTY_VALUE;
}
else
{
ssl[i] = iMA(Symbol(),TimeFrame,Lb,0,MODE_SMA,PRICE_LOW,i+1);
sslHup[i] = SSL_BarLevel; sslHdn[i]=EMPTY_VALUE;
}
}
return(0);
}
//+------------------------------------------------------------------+
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---