[MT4指标]iStochTxt震荡指标
主图指标
mt4指标类型:震荡指标
是否能用在mt4手机版上:否
是否含有未来函数:无
//+------------------------------------------------------------------+
//| iStochTxt.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright ""
#property link ""
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_width1 1
#property indicator_width2 1
//----
extern int k = 5, s = 3, l = 20;
extern color txtColor = Brown;
//----
int d=3;
//---- buffers
double ExtMapBuffer1;
double ExtMapBuffer2;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0, DRAW_ARROW, STYLE_SOLID, 1);
SetIndexArrow(0, 241);
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexEmptyValue(0, 0.0);
SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID, 1);
SetIndexArrow(1, 242);
SetIndexBuffer(1, ExtMapBuffer2);
SetIndexEmptyValue(1, 0.0);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
for(int i = 0; i < ObjectsTotal(); i++)
{
if(StringFind(ObjectName(i), "txt_", 0) == 0)
{
ObjectDelete(ObjectName(i));
i--;
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
string on;
int limit;
int counted_bars = IndicatorCounted(); // 铒疱溴腓? 觐腓麇耱忸 镳铖麒蜞睇? 徉痤? ? 桧滂赅蝾疣
if(counted_bars > 0)
{
counted_bars--;
}
limit = Bars - counted_bars; // 铒疱溴??屐 沭囗桷? 漕 觐蝾痤? 疣耨麒螓忄屐 珥圜屙?? 桧滂赅蝾疣
//----
for(int i = 0; i < limit; i++)
{
double mc = iStochastic(NULL, 0, k, d, s, 0, 0, MODE_MAIN, i);
double mp = iStochastic(NULL, 0, k, d, s, 0, 0, MODE_MAIN, i + 1);
//----
ExtMapBuffer1 = EMPTY_VALUE;
ExtMapBuffer2 = EMPTY_VALUE;
//----
if(mc > l && mp <= l)
{
ExtMapBuffer1 = Low - iATR(NULL, 0, 14, i);
on = "txt_" + Time;
ObjectDelete(on);
ObjectCreate(on, OBJ_TEXT, 0, Time, Low - 1.5*iATR(NULL, 0, 14, i));
ObjectSetText(on, DoubleToStr(Close, Digits) + " " + TimeToStr(Time,
TIME_MINUTES), 8, "Arial", txtColor);
}
if(mc < 100 - l && mp >= 100 - l)
{
ExtMapBuffer2 = High + iATR(NULL, 0, 14, i);
on = "txt_" + Time;
ObjectDelete(on);
ObjectCreate(on, OBJ_TEXT, 0, Time, High + 2*iATR(NULL, 0, 14, i));
ObjectSetText(on, DoubleToStr(Close, Digits) + " " + TimeToStr(Time,
TIME_MINUTES), 8, "Arial", txtColor);
}
}
//----
return(0);
}
//+------------------------------------------------------------------+iStochTxt.jpg
发表于:2017-08-08 23:32只看该作者
4楼
缺钱,灌水赚通宝,谢谢分享!!
韬客社区www.talkfx.co