Profile cover photo
Profile photo
David Hodgson
7 followers
7 followers
About
David's interests
View all
David's posts

If you want candles to look like Simple Ton's here's the necessary Wickless Candles MT4 Code:

#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 8


//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];

//----
extern int Body = 5;
extern int Wick = 5;
extern color Filled = Black;
extern color HighLow = Black;
extern color Hollow = Black;



int ExtCountedBars=0;
//+----------------------------------------------------------------+
//| Custom indicator initialization function |
//|------------------------------------------------------------------|
int init()
{
//-- indicators
SetIndexStyle(0,DRAW_HISTOGRAM, 0, Wick, HighLow);
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexLabel (0, NULL);
SetIndexStyle(1,DRAW_HISTOGRAM, 0, Wick, HighLow);
SetIndexBuffer(1, ExtMapBuffer2);
SetIndexLabel (1, NULL);
SetIndexStyle(2,DRAW_HISTOGRAM, 0, Body, Hollow);
SetIndexBuffer(2, ExtMapBuffer3);
SetIndexLabel (2, NULL);
SetIndexStyle(3,DRAW_HISTOGRAM, 0, Body, Filled);
SetIndexBuffer(3, ExtMapBuffer5);
SetIndexLabel (3, NULL);
SetIndexStyle(4,DRAW_HISTOGRAM, EMPTY, EMPTY);
SetIndexBuffer(4, ExtMapBuffer5);
SetIndexLabel (4, NULL);
SetIndexStyle(5,DRAW_HISTOGRAM, 0, Wick, HighLow);
SetIndexBuffer(5, ExtMapBuffer6);
SetIndexLabel (5, NULL);

IndicatorShortName("Custom Candle");
//--
SetIndexDrawBegin(0,10);
SetIndexDrawBegin(1,10);
SetIndexDrawBegin(2,10);
SetIndexDrawBegin(3,10);
SetIndexDrawBegin(4,10);
SetIndexDrawBegin(5,10);
SetIndexDrawBegin(6,10);


//-- indicator buffers mapping
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexBuffer(4,ExtMapBuffer5);
SetIndexBuffer(5,ExtMapBuffer6);

//-- initialization done
return(0);
}
//+----------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+----------------------------------------------------------------+
int deinit()
{
//-- TODO: add your code here

//--
return(0);
}
//+----------------------------------------------------------------+
//| Custom indicator iteration function |
//+----------------------------------------------------------------+
int start()
{
double haOpen, haHigh, haLow, haClose;
if(Bars<=10) return(0);
ExtCountedBars=IndicatorCounted();
//-- check for possible errors
if (ExtCountedBars<0) return(-1); //---- last counted bar will be recounted
if (ExtCountedBars>0) ExtCountedBars--;
int pos=Bars-ExtCountedBars-1;
while(pos>=0)
{
haOpen=Open[pos];
haClose=Close[pos];
haHigh=High[pos];
haLow=Low[pos];
if (haOpen<haClose)
{
ExtMapBuffer1[pos]=haLow;
ExtMapBuffer2[pos]=haHigh;
ExtMapBuffer5[pos]=EMPTY_VALUE;
ExtMapBuffer6[pos]=EMPTY_VALUE;

}
else
{
ExtMapBuffer1[pos]=haHigh;
ExtMapBuffer2[pos]=haLow;
ExtMapBuffer5[pos]=EMPTY_VALUE;
ExtMapBuffer6[pos]=EMPTY_VALUE;
}

ExtMapBuffer3[pos]=haOpen;
ExtMapBuffer4[pos]=haClose;

if (haOpen==haClose)
{
ExtMapBuffer5[pos]=haLow;
ExtMapBuffer6[pos]=haHigh;
ExtMapBuffer1[pos]=EMPTY_VALUE;
ExtMapBuffer2[pos]=EMPTY_VALUE;
ExtMapBuffer3[pos]=EMPTY_VALUE;
ExtMapBuffer4[pos]=EMPTY_VALUE;
}
pos--;
}
//----
return(0);
}
//+----------------------------------------------------------------+

Simple little Script that Drops a cluster of Buy Orders on the chart with varying SL/TP targets, at the drop point. I'm sure an MQL Coder could to do this more elegantly....... but it works! :



//+--------------------------------------------------------------+
//| Drop Pending Buys.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+--------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
#property show_inputs
//#property show_confirm

//+--------------------------------------------------------------+
//| script "send pending order with expiration data" |
//+--------------------------------------------------------------+
int start()
{
int ticket,expiration;
double point;
double Price = WindowPriceOnDropped();
//--
point=MarketInfo(Symbol(),MODE_POINT);
expiration=CurTime()+PERIOD_H1*60;
//--
if(Ask > Price)
{
ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.03,WindowPriceOnDropped(),3,WindowPriceOnDropped()-100*Point,WindowPriceOnDropped()+80*Point,"BUY LIMIT 0.03 SL 10 TP 8",16384,expiration,Blue);
ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.02,WindowPriceOnDropped(),3,WindowPriceOnDropped()-120*Point,WindowPriceOnDropped()+150*Point,"BUY LIMIT 0.02 SL 12 TP 15",16384,expiration,Blue);
ticket=OrderSend(Symbol(),OP_BUYLIMIT,0.01,WindowPriceOnDropped(),3,WindowPriceOnDropped()-150*Point,WindowPriceOnDropped()+250*Point,"BUY LIMIT 0.01 SL 15 TP 25",16384,expiration,Blue);
}
if(Ask < Price)
{
ticket=OrderSend(Symbol(),OP_BUYSTOP,0.03,WindowPriceOnDropped(),3,WindowPriceOnDropped()-100*Point,WindowPriceOnDropped()+80*Point,"H1 BUY STOP 0.03 SL 10 TP 8",16384,expiration,Blue);
ticket=OrderSend(Symbol(),OP_BUYSTOP,0.02,WindowPriceOnDropped(),3,WindowPriceOnDropped()-120*Point,WindowPriceOnDropped()+150*Point,"H1 BUY STOP 0.02 SL 12 TP 15",16384,expiration,Blue);
ticket=OrderSend(Symbol(),OP_BUYSTOP,0.01,WindowPriceOnDropped(),3,WindowPriceOnDropped()-150*Point,WindowPriceOnDropped()+250*Point,"H1 BUY STOP 0.01 SL 15 TP 25",16384,expiration,Blue);
}

//--
return(0);
}
//+--------------------------------------------------------------+
Wait while more posts are being loaded