投资者咨询:指标改写为wh6 (文华财经WH6赢顺V6.7)
来源:文华财经 日期:2018-6-26 9:53
//+------------------------------------------------------------------+
//| Heiken Ashi.mq4 |
//| Copyright 2006-2014, MetaQuotes Software Corp. |
//| http://www.mql4.com |
//+------------------------------------------------------------------+
#property copyright "2006-2014, MetaQuotes Software Corp."
#property link "http://www.mql4.com"
#property description "We recommend next chart settings (press F8 or select menu 'Charts'->'Properties...'):"
#property description " - on 'Color' Tab select 'Black' for 'Line Graph'"
#property description " - on 'Common' Tab disable 'Chart on Foreground' checkbox and select 'Line Chart' radiobutton"
#property strict
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 White
#property indicator_color3 Red
#property indicator_color4 White
#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 3
#property indicator_width4 3
//---
input color ExtColor1 = Red; // Shadow of bear candlestick
input color ExtColor2 = White; // Shadow of bull candlestick
input color ExtColor3 = Red; // Bear candlestick body
input color ExtColor4 = White; // Bull candlestick body
//--- buffers
double ExtLowHighBuffer[];
double ExtHighLowBuffer[];
double ExtOpenBuffer[];
double ExtCloseBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//|------------------------------------------------------------------|
void OnInit(void)
{
IndicatorShortName("Heiken Ashi");
IndicatorDigits(Digits);
//--- indicator lines
SetIndexStyle(0,DRAW_HISTOGRAM,0,1,ExtColor1);
SetIndexBuffer(0,ExtLowHighBuffer);
SetIndexStyle(1,DRAW_HISTOGRAM,0,1,ExtColor2);
SetIndexBuffer(1,ExtHighLowBuffer);
SetIndexStyle(2,DRAW_HISTOGRAM,0,3,ExtColor3);
SetIndexBuffer(2,ExtOpenBuffer);
SetIndexStyle(3,DRAW_HISTOGRAM,0,3,ExtColor4);
SetIndexBuffer(3,ExtCloseBuffer);
//---
SetIndexLabel(0,"Low/High");
SetIndexLabel(1,"High/Low");
SetIndexLabel(2,"Open");
SetIndexLabel(3,"Close");
SetIndexDrawBegin(0,10);
SetIndexDrawBegin(1,10);
SetIndexDrawBegin(2,10);
SetIndexDrawBegin(3,10);
//--- indicator buffers mapping
SetIndexBuffer(0,ExtLowHighBuffer);
SetIndexBuffer(1,ExtHighLowBuffer);
SetIndexBuffer(2,ExtOpenBuffer);
SetIndexBuffer(3,ExtCloseBuffer);
//--- initialization done
}
//+------------------------------------------------------------------+
//| Heiken Ashi |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
int i,pos;
double haOpen,haHigh,haLow,haClose;
//---
if(rates_total<=10)
return(0);
//--- counting from 0 to rates_total
ArraySetAsSeries(ExtLowHighBuffer,false);
ArraySetAsSeries(ExtHighLowBuffer,false);
ArraySetAsSeries(ExtOpenBuffer,false);
ArraySetAsSeries(ExtCloseBuffer,false);
ArraySetAsSeries(open,false);
ArraySetAsSeries(high,false);
ArraySetAsSeries(low,false);
ArraySetAsSeries(close,false);
//--- preliminary calculation
if(prev_calculated>1)
pos=prev_calculated-1;
else
{
//--- set first candle
if(open[0]<close[0])
{
ExtLowHighBuffer[0]=low[0];
ExtHighLowBuffer[0]=high[0];
}
else
{
ExtLowHighBuffer[0]=high[0];
ExtHighLowBuffer[0]=low[0];
}
ExtOpenBuffer[0]=open[0];
ExtCloseBuffer[0]=close[0];
//---
pos=1;
}
//--- main loop of calculations
for(i=pos; i<rates_total; i++)
{
haOpen=(ExtOpenBuffer[i-1]+ExtCloseBuffer[i-1])/2;
haClose=(open[i]+high[i]+low[i]+close[i])/4;
haHigh=MathMax(high[i],MathMax(haOpen,haClose));
haLow=MathMin(low[i],MathMin(haOpen,haClose));
if(haOpen<haClose)
{
ExtLowHighBuffer[i]=haLow;
ExtHighLowBuffer[i]=haHigh;
}
else
{
ExtLowHighBuffer[i]=haHigh;
ExtHighLowBuffer[i]=haLow;
}
ExtOpenBuffer[i]=haOpen;
ExtCloseBuffer[i]=haClose;
}
//--- done
return(rates_total);
}
//+------------------------------------------------------------------+
技术人员回复
日期:2018-6-26 10:10
1楼源码与wh6软件指标编写的语法差异较大,无法直接改为wh6的指标
或者您提供一下指标的思路,我们直接帮您编写为文华的指标
投资者咨询:指标改写为wh6 (文华财经WH6赢顺V6.7)
来源:文华财经 日期:2018-6-26 9:53
当15分钟、1小时K线图KDJ指标金叉或死叉时,一分钟K线图KDJ金叉或死叉时,MA5、10金叉或死叉时,MA5、10均线在MA20、40、60、144、上方或下方K线图提示做多或空,当布林带张口时MACD金叉或死叉时,布林带上轨和中轨的值大于下轨和中轨的值时提示加仓做空反之提示做多,当做空收盘价收在MA5上方时提示减仓,当做多时收盘价收在MA5下方时提示减仓,当布林带上轨或下轨掉头、KDJ金叉或死叉时提示平仓,K线图震荡时箱体上沿为压力用红色线标出,下沿用绿色线标出,多空分界线以布林带的中轨用黄色标出,当K线图做空时阳线用绿色实体阴线用绿色空心,当K线图做多时阳线用红色实体阴线用红色空心标出,K线图提示做多或空时K线图页面弹出预警提示。这个编程只预警自选里的品种(也就是我没有看到这个品种它符合买卖的条件弹出预警关注)麻烦老师了谢谢
技术人员回复
日期:2018-6-26 13:08
“ 当15分钟、1小时K线图KDJ指标金叉或死叉时,一分钟K线图KDJ金叉或死叉时”
这样的跨行周期思路无法实现的,因为wh6是专业的看盘软件
无法跨行周期直接引用其他的周期的指标,精心预警的判断,您了解一下
投资者咨询:指标改写为wh6 (文华财经WH6赢顺V6.7)
来源:文华财经 日期:2018-6-26 9:53
技术人员回复
日期:2018-6-26 14:00
整理一下思路以做多为例:
做多条件 :KD金叉 并且 MA5MA10金叉 并且 MA5、10均线在MA20、40、60、144上方
加仓条件 :布林带张口时MACD金叉
减仓条件 :收盘价小于MA5
平仓条件:布林带上轨或下轨掉头并且KDJ金叉或死叉
是否可以呢?
投资者咨询:指标改写为wh6 (文华财经WH6赢顺V6.7)
来源:文华财经 日期:2018-6-26 9:53
技术人员回复
日期:2018-6-26 14:20
其他条件是否可以呢?
投资者咨询:指标改写为wh6 (文华财经WH6赢顺V6.7)
来源:文华财经 日期:2018-6-26 9:53
技术人员回复
日期:2018-6-26 14:39
编写需要时间,分析后预计本周四之前给您回复