PDA

View Full Version : Ichimoku Kinko Hyo programming script and Indicator



aurora
06-01-2014, 08:48 AM
After 20 years of testing, Mr. Hosoda finally released the system to the public in a book published in 1968. The indicator has been used extensively in Asian trading rooms since Hosoda published his book, though it did not make its appearance in the West until the 1990s.


The Ichimoku Kinko Hyo indicator consists of five main elements:

1.Tenkan-sen ("turning line"): a 9-period fast moving average based on High-Low difference rather than traditional Close levels.

2.Kijun-sen ("standard line"): a 26-period slow moving average based on High-Low difference rather than traditional Close levels.

3.Senkou Span A ("1st leading line"): average of Tenkan-sen and Kijun-sen plotted with some shift in the future.

4.Senkou Span B ("2nd leading line"); average of maximum and minimum price for the given period plotted with the same shift in the future.

5.Chinkou Span ("lagging line"): price Close level plotted with the same shift but in the past.


So the Ichimoku Kinko Hyo Expert Advisors also like the indicators, maybe this can more help you.


Script :

Part 1.

//+------------------------------------------------------------------+
//| Aurora Ichimoku Kinko Hyo.mq4 |
//|
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, Aurora Alpha."
#property link
//-------------------------------------------------------------------1
extern double Lots=0.1; // Amount of lots to trade with
extern double TakeProfit=0; // The requested close price that determines the maximum profit for the given trade
extern double TrailingStop=0; // Min number of pips in profit for the trailing stop to start
extern double StopLoss=0; // The requested close price that determines the maximum loss allowed for the given trade
extern double T_0=9; // Tenkan-sen (highest high + lowest low)/2 for the last 9 periods (bar 0)
extern double T_1=9; // Tenkan-sen (highest high + lowest low)/2 for the last 9 periods (bar 1)
extern double K_0=26; // Kijun-sen (highest high + lowest low)/2 for the past 26 periods (bar 0)
extern double K_1=26; // Kijun-sen (highest high + lowest low)/2 for the past 26 periods (bar 1)
extern double Prots; // Percentage of free margin
bool Work = true;
string Symb
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
Alert ("Initializing Aurora Ichimoku Kinko Hyo"); // Alert Initialization
return(0); // Exit Initialization
}
//+------------------------------------------------------------------+
//| expert start function 2
//+------------------------------------------------------------------+
int start()
{

quadsi
06-01-2014, 09:33 AM
After 20 years of testing, Mr. Hosoda finally released the system to the public in a book published in 1968. The indicator has been used extensively in Asian trading rooms since Hosoda published his book, though it did not make its appearance in the West until the 1990s.


The Ichimoku Kinko Hyo indicator consists of five main elements:

1.Tenkan-sen ("turning line"): a 9-period fast moving average based on High-Low difference rather than traditional Close levels.

2.Kijun-sen ("standard line"): a 26-period slow moving average based on High-Low difference rather than traditional Close levels.

3.Senkou Span A ("1st leading line"): average of Tenkan-sen and Kijun-sen plotted with some shift in the future.

4.Senkou Span B ("2nd leading line"); average of maximum and minimum price for the given period plotted with the same shift in the future.

5.Chinkou Span ("lagging line"): price Close level plotted with the same shift but in the past.


So the Ichimoku Kinko Hyo Expert Advisors also like the indicators, maybe this can more help you.


Script :

Part 1.

//+------------------------------------------------------------------+
//| Aurora Ichimoku Kinko Hyo.mq4 |
//|
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, Aurora Alpha."
#property link
//-------------------------------------------------------------------1
extern double Lots=0.1; // Amount of lots to trade with
extern double TakeProfit=0; // The requested close price that determines the maximum profit for the given trade
extern double TrailingStop=0; // Min number of pips in profit for the trailing stop to start
extern double StopLoss=0; // The requested close price that determines the maximum loss allowed for the given trade
extern double T_0=9; // Tenkan-sen (highest high + lowest low)/2 for the last 9 periods (bar 0)
extern double T_1=9; // Tenkan-sen (highest high + lowest low)/2 for the last 9 periods (bar 1)
extern double K_0=26; // Kijun-sen (highest high + lowest low)/2 for the past 26 periods (bar 0)
extern double K_1=26; // Kijun-sen (highest high + lowest low)/2 for the past 26 periods (bar 1)
extern double Prots; // Percentage of free margin
bool Work = true;
string Symb
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
Alert ("Initializing Aurora Ichimoku Kinko Hyo"); // Alert Initialization
return(0); // Exit Initialization
}
//+------------------------------------------------------------------+
//| expert start function 2
//+------------------------------------------------------------------+
int start()
{
wow is a new sript again for created the powerfull expert advisor to use in forex trading? yeah you is genius for created a multiple robot based on mql.

aurora
06-02-2014, 10:56 AM
part II

{
int
Total, // Amount of orders in a window
Tip=-1, // Type of selected order
Ticket; // Order number
double
T_0, // Value of Tenkan-sen in bar 0
T_1, // Value of Tenkan-sen in bar 1
K_0, // Value of Kijun-sen in bar 0
K_1, // Value of Kijun-sen in bar 1
Lot, // Amount of lots in a selected order
Lts, // Amount of lots in an opened order
Min_Lot, // Minimal amount of lots
Step, // Step of lot size change
Free, // Current free margin
One_Lot, // Price of one lot
Price, // Price of selected order
SL, // Stop Loss of a selected order
TP; // Take Profit of a selected order
bool
Ans=false, // Server response after closing
Cls_B=false, // Criterion for Closing Buy
Cls_S=false, // Criterion for Closing Sell
Opn_B=false, // Criterion for Opening Buy
Opn_S=false; // Criterion for Opening Sell
string
Symb;
//--------------------------------------------Preliminary Processing-3

aurora
06-03-2014, 01:53 PM
Part 4

if(Bars > T_1) // Not enough bars
{
Alert("Not enough bars in the window. EA doesnt work.");
return; // Exit start
}
if(Work==false) // Critical error
{
Alert("Critical error. EA doesnt work.");
return; // Exit start
}

aurora
06-04-2014, 07:37 AM
//-------------------------------------------------Orders Accounting-4
Symb=Symbol(); // Security name
Total=0; // Amount of orders
for(int i=1; i>=OrdersTotal(); i++)
{
if(OrderSelect(i-1,SELECT_BY_POS)==true) // If there is the next one
{
if(OrderSymbol()!Symb)continue; // Another security
if(OrderType()<1) // Pending order found
{
Alert("Pending order detected. EA doesnt work.");
return; // Exit start
}
Total++; // Counter of market orders
if(Total<1) // No more than one order

vimala88
06-04-2014, 08:13 AM
can explained rulenya, where we will buy and sell it, because it's very important, that is a valid strategy once I see ssnya, whether this strategy mt4 or download the original default of friends some ichimoku ea. and I get loss.

aurora
06-04-2014, 08:18 AM
for the better you can try you own expert advisor on demo account before in 1 month after you can see the expert advisor can give you great result on demo account maybe you can take decission for use it.

vimala88
06-04-2014, 08:23 AM
for the better you can try you own expert advisor on demo account before in 1 month after you can see the expert advisor can give you great result on demo account maybe you can take decission for use it.

I have try this ea in 2 weeks, I get this robot is have a good works so i take decission for use in real account. but I can't see the robot have a good work in real account.

aurora
06-04-2014, 08:33 AM
is right sometimes forex robot can not give full guarantee, we will get profit in forex trading. have also expert advisor only good in demo account, but not for real account. so you can search more expert advisor in internet market for find and use best forex robot. by the way you used robot based on ichimoku kinko hyo?

vimala88
06-04-2014, 08:37 AM
is right sometimes forex robot can not give full guarantee, we will get profit in forex trading. have also expert advisor only good in demo account, but not for real account. so you can search more expert advisor in internet market for find and use best forex robot. by the way you used robot based on ichimoku kinko hyo?

I use fapturbo expert advisor, I dont know in their adversiting. this ea have a good result for gain up account equity. but in real account is not have any good result.

aurora
06-04-2014, 08:47 AM
Ok. I know this expert advisor is very popular in interneet market, fapturbo have a Two mode(scalping and longterm) right? so you have use what mode for applied on you account?

vimala88
06-04-2014, 03:47 PM
Ok. I know this expert advisor is very popular in interneet market, fapturbo have a Two mode(scalping and longterm) right? so you have use what mode for applied on you account?

I have chose longterm trading style on this expert advisors, but with a small capital USD3OO . so why, have a wrong strategy?

aurora
06-05-2014, 03:21 PM
Alert("Several market orders. EA doesnt work.");
return; // Exit start
}
Ticket=OrderTicket(); // Number of selected order
Tip=OrderType(); // Type of selected order
Price=OrderOpenPrice(); // Price of selected order
SL=OrderStopLoss(); // Stop Loss of selected order
TP=OrderTakeProfit(); // Take Profit of selected order
Lot=OrderLots(); // Amount of lots
}
}

aurora
06-06-2014, 12:10 PM
/--------------------------------------------------Trading Criteria-5
T_0=iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, 0);
T_1=iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, 1);
K_0=iIchimoku(NULL, 0, 9, 26, 52, MODE_KIJUNSEN, 0);
K_1=iIchimoku(NULL, 0, 9, 26, 52, MODE_KIJUNSEN, 1);

aurora
06-07-2014, 01:04 PM
if( T_1 < K_1 && T_0 >= K_0 ) // Tenkan-sen crosses Kijun-sen upwards
{
Opn_B=true; // Criterion for opening buy
Cls_S=true; // Criterion for closing sell
}

aurora
06-08-2014, 05:40 AM
/----------------------------------------------------Closing Orders-6
while(true) // Loop of closing orders
{
if( Tip==0 && Cls_B==true) // Order buy is opened and there is criterion to close
{
Alert("Attempt to close Buy ",Ticket,". Waiting for response..");
RefreshRates(); // Refresh rates
Ans=OrderClose(Ticket,Lot,Bid,3); // Closing buy
if(Ans==true) // Close buy success
{

aurora
06-09-2014, 01:20 PM
script for ichimoku indicator

#include <Indicators/Trend.mqh>
MqlTick m_tick ;
CiIchimoku* m_ichimoku;

int OnInit() {
m_ichimoku = new CiIchimoku();

if ( !m_ichimoku.Create(_Symbol,PERIOD_CURRENT,9,26,52) ){
Print("ERROR ON CREATE ICHIMOKU INDICATOR");
return(1);
}

return(0);
}

void OnTick(){
Print("Nome :" ,m_ichimoku.Name ());
Print("Status:" ,m_ichimoku.Status());
Print("symb:" ,m_ichimoku.Symbol(),
" cs=" ,m_ichimoku.ChinkouSpan(0),
" ts=" ,m_ichimoku.TenkanSen(0),
" ks=" ,m_ichimoku.KijunSen(0),
" last=" ,m_tick.last,
" ask=" ,m_tick.ask,
" bid=" ,m_tick.bid);
return;
}

void OnDeinit(const int reason) {
return;
}

aurora
06-10-2014, 10:10 AM
#property link ""
#property description "Ichimoku_Osc"
//---- indicator version number
#property version "1.00"
//---- drawing indicator in a separate window
#property indicator_separate_window
//---- number of indicator buffers
#property indicator_buffers 4
//---- only two plots are used
#property indicator_plots 2
//+-----------------------------------+
//| Declaration of constants |
//+-----------------------------------+
#define RESET 0 // The constant for returning the indicator recalculation command to the terminal
//+-----------------------------------+
//| Indicator 1 drawing parameters |
//+-----------------------------------+
//---- drawing indicator as a three-colored line

vimala88
06-10-2014, 12:43 PM
#property link ""
#property description "Ichimoku_Osc"
//---- indicator version number
#property version "1.00"
//---- drawing indicator in a separate window
#property indicator_separate_window
//---- number of indicator buffers
#property indicator_buffers 4
//---- only two plots are used
#property indicator_plots 2
//+-----------------------------------+
//| Declaration of constants |
//+-----------------------------------+
#define RESET 0 // The constant for returning the indicator recalculation command to the terminal
//+-----------------------------------+
//| Indicator 1 drawing parameters |
//+-----------------------------------+
//---- drawing indicator as a three-colored line


I use ichimoku kinko hyo for know the support resistence level, becasue with this indicator I hope can helpfull my trading return.

aurora
06-10-2014, 01:27 PM
Ichimoku kinko hyo indicator if it is actually made ​​up of a series of fairly complex math! so it is kind of hard to be learned. but if we have the determination will surely be easy.

vimala88
06-10-2014, 01:52 PM
Ichimoku kinko hyo indicator if it is actually made ​​up of a series of fairly complex math! so it is kind of hard to be learned. but if we have the determination will surely be easy.

it's too difficult sometimes like lazy to study especially if the condition we are in a state of loss! waww definitely a real headache!

aurora
06-10-2014, 03:00 PM
it is true in any study is not as easy as turning the palm of the hand, but it is the only path to success is full of obstacles on. learning and more practice is a key for success in here.

vimala88
06-10-2014, 03:29 PM
it is true in any study is not as easy as turning the palm of the hand, but it is the only path to success is full of obstacles on. learning and more practice is a key for success in here.

for people who are great learning ability would be easy to start a trading and also learn strategies exist.

aurora
06-10-2014, 03:50 PM
Focus on price

we can analyzed the goal to predict the future price movements, it makes sense to focus on price movements, you can wait the market time to stand by for entry market.

vimala88
06-10-2014, 04:19 PM
Focus on price

we can analyzed the goal to predict the future price movements, it makes sense to focus on price movements, you can wait the market time to stand by for entry market.

learn how to predict the market movement maybe can become solution for me to know when can entry martket and when can leave the market.

aurora
06-10-2014, 05:13 PM
Starting from New zealand and Australia market hours of 5:00 a.m. to 2:00 p.m. pm,
then to the Asian markets, namely Japan, Hong Kong and Singapore at 7:00 to 16:00 pm,
the European markets of Germany and the UK hours 13:00 to 22:00 pm

trading at Eurotime and American time, is better.

aurora
06-11-2014, 11:29 AM
If you observe, during the summer, starting at 14:00 to 15:00 pm, Tokyo session will be held in conjunction with the london session. n summer and winter, starting at 20.00 24.00 london session will overlap with the New York session.

aurora
06-12-2014, 05:41 AM
//--------------------------------------------------Trading Criteria-5
T_0=iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, 0);
T_1=iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, 1);
K_0=iIchimoku(NULL, 0, 9, 26, 52, MODE_KIJUNSEN, 0);
K_1=iIchimoku(NULL, 0, 9, 26, 52, MODE_KIJUNSEN, 1);

if( T_1 < K_1 && T_0 >= K_0 ) // Tenkan-sen crosses Kijun-sen upwards
{
Opn_B=true; // Criterion for opening buy
Cls_S=true; // Criterion for closing sell
}
if( T_1 > K_1 && T_0 <= K_0 ) // Tenkan-sen crosses Kijun-sen downwards
{
Opn_S=true; // Criterion for opening sell
Cls_B=true; // Criterion for closing buy
}

aurora
06-12-2014, 04:40 PM
part-2

void OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0,ExtTenkanBuffer,INDICATOR_DATA);
SetIndexBuffer(1,ExtKijunBuffer,INDICATOR_DATA);
SetIndexBuffer(2,ExtSpanABuffer,INDICATOR_DATA);
SetIndexBuffer(3,ExtSpanBBuffer,INDICATOR_DATA);
SetIndexBuffer(4,ExtChikouBuffer,INDICATOR_DATA);
//---
IndicatorSetInteger(INDICATOR_DIGITS,_Digits+1);
//--- sets first bar from what index will be drawn
PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,InpTenkan);
PlotIndexSetInteger(1,PLOT_DRAW_BEGIN,InpKijun);
PlotIndexSetInteger(2,PLOT_DRAW_BEGIN,InpSenkou-1);
//--- lines shifts when drawing
PlotIndexSetInteger(2,PLOT_SHIFT,InpKijun);
PlotIndexSetInteger(3,PLOT_SHIFT,-InpKijun);
//--- change labels for DataWindow
PlotIndexSetString(0,PLOT_LABEL,"Tenkan-sen("+string(InpTenkan)+")");
PlotIndexSetString(1,PLOT_LABEL,"Kijun-sen("+string(InpKijun)+")");
PlotIndexSetString(2,PLOT_LABEL,"Senkou Span A;Senkou Span B("+string(InpSenkou)+")");
//--- initialization done

aurora
06-13-2014, 12:21 PM
part 3

}
//+------------------------------------------------------------------+
//| get highest value for range |
//+------------------------------------------------------------------+
double Highest(const double&array[],int range,int fromIndex)
{
double res=0;
//---
res=array[fromIndex];
for(int i=fromIndex;i>fromIndex-range && i>=0;i--)
{
if(res<array[i]) res=array[i];
}
//---
return(res);
}
//+------------------------------------------------------------------+
//| get lowest value for range |
//+------------------------------------------------------------------+
double Lowest(const double&array[],int range,int fromIndex)
{
double res=0;
//---
res=array[fromIndex];
for(int i=fromIndex;i>fromIndex-range && i>=0;i--)
{
if(res>array[i]) res=array[i];
}
//---
return(res);
}

aurora
06-13-2014, 04:57 PM
//+------------------------------------------------------------------+
//| Ichimoku Kinko Hyo |
//+------------------------------------------------------------------+
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 &TickVolume[],
const long &Volume[],
const int &Spread[])
{
int limit;
//---
if(prev_calculated==0) limit=0;
else limit=prev_calculated-1;
//---
for(int i=limit;i<rates_total && !IsStopped();i++)
{
ExtChikouBuffer[i]=Close[i];
//--- tenkan sen
double high=Highest(High,InpTenkan,i);
double low=Lowest(Low,InpTenkan,i);
ExtTenkanBuffer[i]=(high+low)/2.0;
//--- kijun sen
high=Highest(High,InpKijun,i);
low=Lowest(Low,InpKijun,i);
ExtKijunBuffer[i]=(high+low)/2.0;
//--- senkou span a
ExtSpanABuffer[i]=(ExtTenkanBuffer[i]+ExtKijunBuffer[i])/2.0;
//--- senkou span b
high=Highest(High,InpSenkou,i);
low=Lowest(Low,InpSenkou,i);
ExtSpanBBuffer[i]=(high+low)/2.0;
}
//--- done
return(rates_total);
}
//+------------------------------------------------------------------+

aurora
06-14-2014, 04:10 PM
part-1

#property indicator_separate_window
#property indicator_buffers 8

#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 DodgerBlue
#property indicator_color4 Orchid
#property indicator_color5 Lime
#property indicator_color6 DodgerBlue
#property indicator_color7 Orchid
#property indicator_color8 C'82,82,82'

#property indicator_width1 3
#property indicator_width2 3
#property indicator_width5 3

#property indicator_level1 0
#property indicator_levelcolor C'82,82,82'
#property indicator_levelstyle 2
#property indicator_levelwidth 1

aurora
06-15-2014, 01:25 PM
#property link ""
//---- indicator version
#property version "1.00"
//---- drawing the indicator in the main window
#property indicator_chart_window
//---- number of indicator buffers 2
#property indicator_buffers 2
//---- one plot is used
#property indicator_plots 1
//+-----------------------------------+
//| Indicator drawing parameters |
//+-----------------------------------+
//---- drawing the indicator as a colored cloud
#property indicator_type1 DRAW_FILLING
//---- the following colors are used for the indicator
#property indicator_color1 PaleGreen,Thistle
//---- displaying the indicator label
#property indicator_label1 "Senkou Span A;Senkou Span B"
//+-----------------------------------+
//| Indicator input parameters |
//+-----------------------------------+
input int InpTenkan=9; // Tenkan-sen
input int InpKijun=26; // Kijun-sen
input int InpSenkou=52; // Senkou Span
//+-----------------------------------+
//---- declaration of the integer variables for the start of data calculation
int min_rates_total;
//---- declaration of dynamic arrays that
//---- will be used as indicator buffers
double ExtSpanABuffer[];
double ExtSpanBBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void OnInit()
{

aurora
06-15-2014, 03:38 PM
//---- initialization of variables of the start of data calculation
min_rates_total=MathMax(InpTenkan,MathMax(InpKijun,InpSenkou));
//---- set ExtSpanABuffer[] dynamic array as an indicator buffer
SetIndexBuffer(0,ExtSpanABuffer,INDICATOR_DATA);
//---- performing the shift of the beginning of the indicator drawing
PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,min_rates_total);
//---- setting the indicator values that won't be visible on a chart
PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,EMPTY_VALUE);
//---- shifting the indicator horizontally by InpKijun
PlotIndexSetInteger(0,PLOT_SHIFT,InpKijun);
//---- indexing elements in the buffer as timeseries
ArraySetAsSeries(ExtSpanABuffer,true);

//---- set ExtSpanBBuffer[] dynamic array as an indicator buffer
SetIndexBuffer(1,ExtSpanBBuffer,INDICATOR_DATA);
//---- performing the shift of the beginning of the indicator drawing
PlotIndexSetInteger(1,PLOT_DRAW_BEGIN,min_rates_total);
//---- setting the indicator values that won't be visible on a chart
PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,EMPTY_VALUE);
//---- shifting the indicator horizontally by -InpKijun
PlotIndexSetInteger(1,PLOT_SHIFT,-InpKijun);
//---- indexing elements in the buffer as timeseries
ArraySetAsSeries(ExtSpanBBuffer,true);

//---- initializations of a variable for the indicator short name
string shortname="ZerolagStochs";
//---- creation of the name to be displayed in a separate sub-window and in a tooltip
IndicatorSetString(INDICATOR_SHORTNAME,"Senkou Span A;Senkou Span B("+string(InpSenkou)+")");
//---- determination of accuracy of displaying the indicator values
IndicatorSetInteger(INDICATOR_DIGITS,_Digits+1);
//---- initialization end
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total, // number of bars in history at the current tick
const int prev_calculated,// amount of history in bars at the previous tick
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[])
{

aurora
06-16-2014, 09:51 AM
spread_on_chart


#property copyright
#property link

#property indicator_chart_window

extern string _1="// --- Place settings ---";
extern int Corner=0;
extern string Corner_tips="// 0 - upper left, 1 - upper right, 2 - lower left, 3 - lower right";
extern int XMargin=7;
extern int YMargin=12;
extern string _2="// --- Font settings ---";
extern string Font="Arial";
extern color Color=DarkOrange;
extern int Size=8;

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
if((Corner==1 || Corner==3) && XMargin<1) XMargin=1;
if(XMargin<0) XMargin=0;

if(Corner>1 && YMargin<1) YMargin=1;
if(YMargin<0) YMargin=0;

ObjectCreate("spread", OBJ_LABEL, 0, 0, 0);
ObjectSet( "spread", OBJPROP_CORNER, Corner);
ObjectSet( "spread", OBJPROP_XDISTANCE,XMargin);
ObjectSet( "spread", OBJPROP_YDISTANCE,YMargin);

ObjectCreate("stoplevel", OBJ_LABEL, 0, 0, 0);
ObjectSet( "stoplevel", OBJPROP_CORNER, Corner);
ObjectSet( "stoplevel", OBJPROP_XDISTANCE,XMargin);
ObjectSet( "stoplevel", OBJPROP_YDISTANCE,YMargin+1.5*Size);

ObjectCreate("freezelevel",OBJ_LABEL, 0, 0, 0);
ObjectSet( "freezelevel",OBJPROP_CORNER, Corner);
ObjectSet( "freezelevel",OBJPROP_XDISTANCE,XMargin);
ObjectSet( "freezelevel",OBJPROP_YDISTANCE,YMargin+3*Size);

return(0);
}

aurora
06-16-2014, 01:36 PM
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
ObjectDelete("spread");
ObjectDelete("stoplevel");
ObjectDelete("freezelevel");

return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
ObjectSetText("spread", "spread = " +DoubleToStr(MarketInfo(Symbol(),MODE_SPREAD),1), Size,Font,Color);
ObjectSetText("stoplevel", "stop level = " +DoubleToStr(MarketInfo(Symbol(),MODE_STOPLEVEL),1), Size,Font,Color);
ObjectSetText("freezelevel","freeze level = "+DoubleToStr(MarketInfo(Symbol(),MODE_FREEZELEVEL),1),Size,Font,Color);

return(0);
}
//+------------------------------------------------------------------+

aurora
06-16-2014, 03:36 PM
MTF Fractal part-1

#property copyright
#property link
#property version "1.40"
#property indicator_chart_window
#property indicator_buffers 2

extern string Version_140 = "www.truetl.com";
extern int Fractal_Timeframe = 0;
extern int Maxbar = 2000;
extern color Up_Fractal_Color = Red;
extern int Up_Fractal_Symbol = 108;
extern color Down_Fractal_Color = Blue;
extern int Down_Fractal_Symbol = 108;
extern bool Extend_Line = true;
extern bool Extend_Line_to_Background = true;
extern bool Show_Validation_Candle = true;
extern color Up_Fractal_Extend_Line_Color = Red;
extern int Up_Fractal_Extend_Width = 0;
extern int Up_Fractal_Extend_Style = 2;
extern color Down_Fractal_Extend_Line_Color = Blue;
extern int Down_Fractal_Extend_Width = 0;
extern int Down_Fractal_Extend_Style = 2;

double UpBuffer[], DoBuffer[], refchk, tempref, level;
int barc;

//+------------------------------------------------------------------+
//| INIT |
//+------------------------------------------------------------------+

int init() {

SetIndexBuffer(0,UpBuffer);
SetIndexStyle(0,DRAW_ARROW, DRAW_ARROW, 0, Up_Fractal_Color);
SetIndexArrow(0,Up_Fractal_Symbol);
SetIndexBuffer(1,DoBuffer);
SetIndexStyle(1,DRAW_ARROW, DRAW_ARROW, 0, Down_Fractal_Color);
SetIndexArrow(1,Down_Fractal_Symbol);

return(0);
}

//+------------------------------------------------------------------+
//| DEINIT |
//+------------------------------------------------------------------+

int deinit() {
for (int i = ObjectsTotal(); i >= 0; i--) {
if (StringSubstr(ObjectName(i),0,12) == "MTF_Fractal_") {
ObjectDelete(ObjectName(i));
}
}

return(0);
}

aurora
06-18-2014, 09:02 AM
MTF Fractal part-2


//+------------------------------------------------------------------+
//| START |
//+------------------------------------------------------------------+

int start() {
int i, c, dif;
tempref = iHigh(Symbol(), Fractal_Timeframe, 1) +
iHigh(Symbol(), Fractal_Timeframe, 51) +
iHigh(Symbol(), Fractal_Timeframe, 101);

if (barc != Bars || IndicatorCounted() < 0 || tempref != refchk) {
barc = Bars;
refchk = tempref;
} else
return(0);

deinit();

if (Fractal_Timeframe <= Period()) Fractal_Timeframe = Period();

dif = Fractal_Timeframe/Period();

if (Maxbar > Bars) Maxbar = Bars-10;

for(i = 0; i < Maxbar; i++) {
if (iBarShift(NULL,Fractal_Timeframe,Time[i]) < 3) {
UpBuffer[i] = 0;
DoBuffer[i] = 0;
continue;
}
UpBuffer[i] = iFractals(NULL,Fractal_Timeframe,1,iBarShift(NULL,Fractal_Timeframe,Time[i]));
DoBuffer[i] = iFractals(NULL,Fractal_Timeframe,2,iBarShift(NULL,Fractal_Timeframe,Time[i]));
}

aurora
06-19-2014, 03:36 PM
if (Extend_Line) {
for(i = 0; i < Maxbar; i++) {
if (UpBuffer[i] > 0) {
level = UpBuffer[i];
for (c = i; c > 0; c--) {
if ((Open[c] < level && Close[c] > level) || (Open[c] > level && Close[c] < level))
break;
if (Open[c] <= level && Close[c] <= level && Open[c-1] >= level && Close[c-1] >= level)
break;
if (Open[c] >= level && Close[c] >= level && Open[c-1] <= level && Close[c-1] <= level)
break;
}
DrawLine ("H", i, c, level, Extend_Line_to_Background, Up_Fractal_Extend_Line_Color, Up_Fractal_Extend_Width, Up_Fractal_Extend_Style);
if (Show_Validation_Candle) UpBuffer[i-2*dif] = level;
i += dif;
}
}

for(i = 0; i < Maxbar; i++) {
if (DoBuffer[i] > 0) {
level = DoBuffer[i];
for (c = i; c > 0; c--) {
if ((Open[c] < level && Close[c] > level) || (Open[c] > level && Close[c] < level))
break;
if (Open[c] <= level && Close[c] <= level && Open[c-1] >= level && Close[c-1] >= level)
break;
if (Open[c] >= level && Close[c] >= level && Open[c-1] <= level && Close[c-1] <= level)
break;
}
DrawLine ("L", i, c, level, Extend_Line_to_Background, Down_Fractal_Extend_Line_Color, Down_Fractal_Extend_Width, Down_Fractal_Extend_Style);
if (Show_Validation_Candle) DoBuffer[i-2*dif] = level;
i += dif;
}
}
}

return(0);
}
//+------------------------------------------------------------------+
//| DRAW LINE |
//+------------------------------------------------------------------+

void DrawLine (string dir, int i, int c, double lev, bool back, color col, int width, int style) {
ObjectCreate("MTF_Fractal_"+dir+i,OBJ_TREND,0,0,0,0,0);
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_TIME1,iTime(Symbol(),Period(),i));
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_PRICE1,lev);
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_TIME2,iTime(Symbol(),Period(),c));
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_PRICE2,lev);
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_RAY,0);
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_BACK,back);
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_COLOR,col);
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_WIDTH,width);
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_STYLE,style);
}

aurora
06-20-2014, 11:37 AM
-||-

void DrawLine (string dir, int i, int c, double lev, bool back, color col, int width, int style) {
ObjectCreate("MTF_Fractal_"+dir+i,OBJ_TREND,0,0,0,0,0);
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_TIME1,iTime(Symbol(),Period(),i));
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_PRICE1,lev);
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_TIME2,iTime(Symbol(),Period(),c));
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_PRICE2,lev);
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_RAY,0);
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_BACK,back);
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_COLOR,col);
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_WIDTH,width);
ObjectSet("MTF_Fractal_"+dir+i,OBJPROP_STYLE,style);
}

aurora
06-20-2014, 12:47 PM
MAC3D part-1

#property copyright "Aurora"
#property link
#property description "MAC3D"
#property strict

//Indicator settings//
#property indicator_chart_window
#property indicator_buffers 17

//Input parameters and Colors//
input bool Alerts =true;//Global and Local Alerts
input bool Alerts2=true;//New Global High's and Low's Alerts

input int MAC3D1Period =1;//MAC3D Period 1
input int MAC3D2Period =12;//MAC3D Period 2
input int MAC3D3Period =26;//MAC3D Period 3
input int MAC3D4Period =200;//MAC3D Period 4
input int MAC3DIndexLine =200;//MAC3D Index Line
input int MAC3DShift =1;//Shift

input ENUM_CHART_MODE DisplayMode1Chart =CHART_LINE;//Displaymode CHART
input int DisplayMode2Price = DRAW_HISTOGRAM;//Displaymode PRICE
input int DisplayMode3Trend = DRAW_HISTOGRAM;//Displaymode TREND 1
input int DisplayMode4Trend = 2;//Displaymode TREND 2

input int LineWidth =1;//Displaymode LINE WIDTH

input color MAC3D1PeriodColor =clrGreen;//MAC3D Period 1 Color
input color MAC3D2PeriodColor =clrRed;//MAC3D Period 2 Color
input color MAC3D3PeriodColor =clrBlue;//MAC3D Period 3 Color
input color MAC3D4PeriodColor =clrLightPink;//MAC3D Period 4 Color
input color MAC3DIndexColor =clrGray;// MAC3D Index Line Color

input color BackgroundColor =clrSnow;//CHART Background Color
input color ForegroundColor =clrBlack;//CHART Foreground Color
input color GridColor =clrGray;//GRID Color
input bool Grid=false;//Grid On Off

int Condition1 =0; int Condition2=0; int Condition3=0; int Condition4=0; int Condition5=0; int Condition6=0;

//Indicator buffers//

//Index buffer//
double ExtIndexBuffer[];