Miscellaneous
0
Views
0
Downloads
0
Favorites
Setka_v1
//+------------------------------------------------------------------+
//| _KON12_R01.mq4 |
//| Copyright © 2008, Dante Software |
//| |
//+------------------------------------------------------------------+
#property copyright "kon12"
#property link ""
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 White
extern int LineMax = 8;
extern color LineColor = Silver;
double S,P,Step,Smin,Smax;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetIndexBuffer(0,S);
SetIndexStyle(0,DRAW_LINE,2);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
S = 1.05*(High[ArrayMaximum(High,WindowFirstVisibleBar(),0)]
-Low[ArrayMinimum(Low,WindowFirstVisibleBar(),0)])/LineMax/Point/10;
if (S==P) {return(0);}
for(int r=1; r>=0; r--)
{
for (int i=ObjectsTotal()-1; i>=0 ; i--)
{if (StringFind (ObjectName(i), "Setka") >= 0) ObjectDelete (ObjectName(i)) ;}
Step=20000*Point;
if (S>500 && S<=1000) {Step=10000*Point;}
if (S>200 && S<=500) {Step=5000*Point;}
if (S>100 && S<=200) {Step=2000*Point;}
if (S>50 && S<=100) {Step=1000*Point;}
if (S>20 && S<=50) {Step=500*Point;}
if (S>10 && S<=20) {Step=200*Point;}
if (S<=10) {Step=100*Point;}
Smin=MathRound(Low[ArrayMinimum(Low,WindowFirstVisibleBar(),0)]/Step-2)*Step;
Smax=MathRound(High[ArrayMaximum(High,WindowFirstVisibleBar(),0)]/Step+2)*Step;
for (double Sprice = Smin; Sprice <= Smax; Sprice += Step) {
string Sname = "Setka"+DoubleToStr(Sprice,Digits);
ObjectCreate (Sname, OBJ_HLINE, 0, 0, Sprice);
ObjectSet (Sname, OBJPROP_COLOR, LineColor);
ObjectSet (Sname, OBJPROP_STYLE, 2);
ObjectSet (Sname, OBJPROP_BACK, 0);
}}
P=S;
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
---