Register for free to join our community of investors and share your ideas. You will also get access to streaming quotes, interactive charts, trades, portfolio, live options flow and more tools.

Live Updating

KMX - short at 44.82

ISIS - short at 22.46

CLDX - short at 13.45

OHI - short at 32.14

INTC - short at 23.40

NWL - short at 26.45

RPAI - short at 14.98

TOS SQ9 Study

Modified this from Richard Houser's code on the Yahoo TOS group. Plan to go back and make it autoadjust to the highest/lowest on the chart and add the 30 degree hashes and the 72/144 also. Works pretty good though!

declare upper;

input date = 20120628;

input priceType = { default low, high };

input offset = 40;

def sign = if priceType == priceType.low then (1) else (-1);

def p1 = if GetYYYYMMDD() == date

then if priceType == priceType.low

then low

else high

else Double.NaN;

def price = if priceType == priceType.low then LowestAll( p1 ) else HighestAll( p1 );

def sqrtPrice = Sqrt( price );

plot i0 = price;

plot i1 = Sqr( sqrtPrice + ( 0.25 * sign ) );

plot i2 = Sqr( sqrtPrice + ( 0.50 * sign ) );

plot i3 = Sqr( sqrtPrice + ( 0.75 * sign ) );

plot i4 = Sqr( sqrtPrice + ( 1.00 * sign ) );

plot i5 = Sqr( sqrtPrice + ( 1.25 * sign ) );

plot i6 = Sqr( sqrtPrice + ( 1.50 * sign ) );

plot i7 = Sqr( sqrtPrice + ( 1.75 * sign ) );

plot i8 = Sqr( sqrtPrice + ( 2.00 * sign ) );

plot i9 = Sqr( sqrtPrice + ( 2.25 * sign ) );

plot i10 = Sqr( sqrtPrice + ( 2.5 * sign ) );

plot i11 = Sqr( sqrtPrice + ( 2.75 * sign ) );

plot i12 = Sqr( sqrtPrice + ( 3.00 * sign ) );

plot i13 = Sqr( sqrtPrice + ( 3.25 * sign ) );

plot i14 = Sqr( sqrtPrice + ( 3.50 * sign ) );

plot i15 = Sqr( sqrtPrice + ( 3.75 * sign ) );

plot i16 = Sqr( sqrtPrice + ( 4.00 * sign ) );

#===============================[ Look & Feel ]================================

i0.SetPaintingStrategy( PaintingStrategy.HORIZONTAL );

i0.SetDefaultColor( GetColor( 7 ) );

i0.HideBubble();

i1.SetPaintingStrategy( PaintingStrategy.HORIZONTAL );

i1.SetDefaultColor( GetColor( 7 ) );

##i1.HideBubble();

i2.SetPaintingStrategy( PaintingStrategy.HORIZONTAL );

i2.SetDefaultColor( GetColor( 7 ) );

##i2.HideBubble();

i3.SetPaintingStrategy( PaintingStrategy.HORIZONTAL );

i3.SetDefaultColor( GetColor( 7 ) );

##i3.HideBubble();

i4.SetPaintingStrategy( PaintingStrategy.HORIZONTAL );

i4.SetDefaultColor( GetColor( 7 ) );

##i4.HideBubble();

i5.SetPaintingStrategy( PaintingStrategy.HORIZONTAL );

i5.SetDefaultColor( GetColor( 7 ) );

##i5.HideBubble();

i6.SetPaintingStrategy( PaintingStrategy.HORIZONTAL );

i6.SetDefaultColor( GetColor( 7 ) );

##i6.HideBubble();

i7.SetPaintingStrategy( PaintingStrategy.HORIZONTAL );

i7.SetDefaultColor( GetColor( 7 ) );

##i7.HideBubble();

i8.SetPaintingStrategy( PaintingStrategy.HORIZONTAL );

i8.SetDefaultColor( GetColor( 7 ) );

##i8.HideBubble();

i9.SetPaintingStrategy( PaintingStrategy.HORIZONTAL );

i9.SetDefaultColor( GetColor( 7 ) );

i10.SetPaintingStrategy( PaintingStrategy.HORIZONTAL );

i10.SetDefaultColor( GetColor( 7 ) );

i11.SetPaintingStrategy( PaintingStrategy.HORIZONTAL );

i11.SetDefaultColor( GetColor( 7 ) );

i12.SetPaintingStrategy( PaintingStrategy.HORIZONTAL );

i12.SetDefaultColor( GetColor( 7 ) );

i13.SetPaintingStrategy( PaintingStrategy.HORIZONTAL );

i13.SetDefaultColor( GetColor( 7 ) );

i14.SetPaintingStrategy( PaintingStrategy.HORIZONTAL );

i14.SetDefaultColor( GetColor( 7 ) );

i15.SetPaintingStrategy( PaintingStrategy.HORIZONTAL );

i15.SetDefaultColor( GetColor( 7 ) );

i16.SetPaintingStrategy( PaintingStrategy.HORIZONTAL );

i16.SetDefaultColor( GetColor( 7 ) );

AddChartBubble(!IsNaN(close[offset]) and IsNaN(close[offset-1]), i1, "45 D " , Color.green);

AddChartBubble(!IsNaN(close[offset]) and IsNaN(close[offset-1]), i2, "90 D " , Color.green);

AddChartBubble(!IsNaN(close[offset]) and IsNaN(close[offset-1]), i3, "135 D " , Color.green);

AddChartBubble(!IsNaN(close[offset]) and IsNaN(close[offset-1]), i4, "180 D " , Color.green);

AddChartBubble(!IsNaN(close[offset]) and IsNaN(close[offset-1]), i5, "225 D " , Color.green);

AddChartBubble(!IsNaN(close[offset]) and IsNaN(close[offset-1]), i6, "270 D " , Color.green);

AddChartBubble(!IsNaN(close[offset]) and IsNaN(close[offset-1]), i7, "315 D " , Color.green);

AddChartBubble(!IsNaN(close[offset]) and IsNaN(close[offset-1]), i8, "360 D " , Color.green);

AddChartBubble(!IsNaN(close[offset]) and IsNaN(close[offset-1]), i9, "405 D " , Color.green);

AddChartBubble(!IsNaN(close[offset]) and IsNaN(close[offset-1]), i10, "450 D " , Color.green);

AddChartBubble(!IsNaN(close[offset]) and IsNaN(close[offset-1]), i11, "495 D " , Color.green);

AddChartBubble(!IsNaN(close[offset]) and IsNaN(close[offset-1]), i12, "540 D " , Color.green);

AddChartBubble(!IsNaN(close[offset]) and IsNaN(close[offset-1]), i13, "585 D " , Color.green);

AddChartBubble(!IsNaN(close[offset]) and IsNaN(close[offset-1]), i14, "630 D " , Color.green);

AddChartBubble(!IsNaN(close[offset]) and IsNaN(close[offset-1]), i15, "675 D " , Color.green);

AddChartBubble(!IsNaN(close[offset]) and IsNaN(close[offset-1]), i16, "720 D " , Color.green);

TOS Scan that I have been working with that looks for bar counts between high and low that are along the 270 degree of the SQ9. So far TOS seems woefully inadequate for scanning by date since only constants are allowed with many of the date functions like getYYYYMMDD()[1] works but not replacing the "1" with a variable. Either that or I don't know enough about it yet!

Anyway, here is the scan along with a fundamental filter of last>10, it looks for the high or low of the last 300 bars to be within the last 10 days too.

def highbar = getmaxvalueoffset(high,500);

def lowbar = getminvalueoffset(low,500);

def range = if highbar<10 or lowbar<10 and volume[1]>volumeavg(50) and volume[1]>500000 then absvalue(highbar-lowbar) else 0;

plot lookup = if range==72 or range==144 or range==25 or range ==49 or range==81 or range==121 or range ==169 or range==361 and volume[1]>500000 then range else double.NaN;

Hey Git, visiting from Simple's board, will be sure to check out what you have going on.

Welcome! This board is for all things Gann style!

http://www.forex-tsd.com/expert-advisors-metatrader-4/58-trailing-stop-ea.html

http://metatrader5.blogspot.com/

And I sent you one back with the two errors....they were really boneheaded!

What was it, just sent you email about what I thought it might be.

AHHHHHHHHHHHHHHHHHHHHHHH I FOUND IT!

LOL, don't mind tellin ya this is taxing the sheet outta my feeble mind!

Solve my error and then worry about it - LOL!

Here are some cool links on the subject though.

http://codebase.mql4.com/4332

http://www.metatrader4.com/forum/1507

http://www.metatrader4.com/forum/1748

Looking forward to seeing your approach Sherri!

I have the code to compare the time and only execute at the beginning of the candle now....will send it to you along with my latest effort later today.

if(OT<1 && TT==True) //Are any orders open already?

{

//SHORT ENTRY

if(down==True && IsTradeAllowed()==True && TimeCurrent()>time+900)

{

int shortticket=OrderSend(Symbol(),OP_SELL,lots,Bid,slippage,SNSL,SNTP,"Short Order Being Placed ",magicnumber,0,Red);

if(shortticket<0)

{

Print("Short Order Send failed - error #",GetLastError());

}

if(shortticket>0)

{

if(OrderSelect(shortticket,SELECT_BY_TICKET,MODE_TRADES))

entry=OrderOpenPrice();

time=TimeCurrent();

Print("SELL order opened : ",OrderOpenPrice(),"|| Target Price : ",entry-scalp);

}

return(0);

}

ahh wait....another stupid idea, but it should work

----------------------------------------------------

Okay, because so many of you asked nicely...

Here is one formula for computing the standard deviation. A warning, this is for math geeks only! Writers and others seeking only a basic understanding of stats don't need to read any more in this chapter. Remember, a decent calculator and stats program will calculate this for you...

Terms you'll need to know

x = one value in your set of data

avg (x) = the mean (average) of all values x in your set of data

n = the number of values x in your set of data

For each value x, subtract the overall avg (x) from x, then multiply that result by itself (otherwise known as determining the square of that value). Sum up all those squared values. Then divide that result by (n-1). Got it? Then, there's one more step... find the square root of that last number. That's the standard deviation of your set of data.

Now, remember how I told you this was one way of computing this? Sometimes, you divide by (n) instead of (n-1). It's too complex to explain here. So don't try to go figuring out a standard deviation if you just learned about it on this page. Just be satisified that you've now got a grasp on the basic concept.

Just got home and going back to work in the morning so it'll have to wait until I've got more time.

I'm working this afternoon too...

Since the SDC is essentially a built in function in MT4, what is the best method to read the top and bottom lines? Unlike the BB or MA Envelopes there doesn't seem to be a MODE_UPPER or MODE_LOWER reading for this and the values seem to be built into MT4 as the STD on each side of the central line. This is the best I've come up with so far, any thoughts?

double SDC_top=NormalizeDouble(ObjectGetValueByShift("regression channel",0)*(STD.Rgres.width),2); //top regression line value

double SDC_bottom=NormalizeDouble(ObjectGetValueByShift("regression channel",0)*(-1*STD.Rgres.width),2); //bottom regression line value

//+------------------------------------------------------------------+

//| GitsAllInOne.mq4 |

//| |

//| |

//+------------------------------------------------------------------+

extern double SL=30;//System Stop Loss

extern double SSL=0.15;//Real Stop Loss

extern double TP=200;//Take Profit

extern double lots=0.10;

extern int slippage=3;

extern int magicnumber=913;

double scalp=0.15;

double entry;

//****** EXTERNAL INDICATOR PARAMETERS ******

//****** RSI ******

extern int rs1=2;

extern int rs2=5;

//****** CCI ******

extern int cc1=48;

extern int ccHi=100;

extern int ccLo=-100;

//****** ADX ******

extern int adx1=14;

//****** macd ******

extern int mfast=12;

extern int mslow=26;

extern int msig=9;

//****** ECO ******

extern int ECO1=9;

extern int ECO2=14;

//****** IFT ******

extern double IHi= 0.50; // default= 0.5

extern double ILo=-0.50; // default=-0.5

extern int RsiB=5; // default=5

extern int WmaB=9; // default=9

//****** conditional bool SUB_TRIGGERS *********

bool ADXgo=false;

bool ADX_long=false;

bool ADX_short=false;

bool RSI_short=false;

bool RSI_long=false;

bool CCI_short=false;

bool CCI_long=false;

bool ECO_short=false;

bool ECO_long=false;

bool IFT_long=false;

bool IFT_short=false;

//****** conditional bool TUNNEL_TRIGGERS *******

bool C_tunn62=False;

bool C_tunn169=False;

bool H_tunn62=False;

bool H_tunn169=False;

bool MACD_long=false;

bool MACD_short=false;

//****** conditional bool MAIN_TRIGGERS ********

bool up=False;

bool down=False;

bool Ltrigger=False;

bool Strigger=False;

//****** TIME TRIGGERS ******

int time;

bool TT=False;

//******************************* TIME TO TRADE ********************************

extern int _sHour=1; // Start hour

extern int _eHour=23; // End hour

int init()

{

time=TimeCurrent();

return(0);

}

int deinit()

{

}

//******************************* START *************************************

int start()

{

//Start/End Time

if(Hour()>=_sHour && Hour()<=_eHour) TT=True; else TT=False;

int D=(Digits);//# of digits after decimal of current pair in the window

//Set System Stop loss and Take profit (mainly in the event of a power loss or PC meltdown

double SNSL=NormalizeDouble(Bid+SL*Point,D);//Short position stop loss

double SNTP=NormalizeDouble(Bid-TP*Point,D);//Short position take profit

double LNSL=NormalizeDouble(Ask-SL*Point,D);//Long position stop loss

double LNTP=NormalizeDouble(Ask+TP*Point,D);//Long position take profit

//************************ NUMBER OF OPEN ORDERS ********************************

int OT=OrdersTotal();

//********************************************************************************

//*************************** INDICATORS ***************************************

//********************************************************************************

//Tunnel EMAs

double E62=NormalizeDouble(iMA(NULL,0,62,0,MODE_EMA,PRICE_TYPICAL,0),D);

double H62=NormalizeDouble(iMA(NULL,60,62,0,MODE_EMA,PRICE_TYPICAL,0),D);

double E144=NormalizeDouble(iMA(NULL,0,144,0,MODE_EMA,PRICE_TYPICAL,0),D);

double H144=NormalizeDouble(iMA(NULL,0,144,0,MODE_EMA,PRICE_TYPICAL,0),D);

double E169=NormalizeDouble(iMA(NULL,0,169,0,MODE_EMA,PRICE_TYPICAL,0),D);

double H169=NormalizeDouble(iMA(NULL,60,169,0,MODE_EMA,PRICE_TYPICAL,0),D);

//RSI Values

double RSI_1=iRSI(NULL,0,rs1,PRICE_TYPICAL,0);//current RSI

double RSI_2=iRSI(NULL,0,rs2,PRICE_TYPICAL,0);//current RSI

double PrevRSI_1=iRSI(NULL,0,rs1,PRICE_TYPICAL,0);//current RSI

double PrevRSI_2=iRSI(NULL,0,rs2,PRICE_TYPICAL,0);//current RSI

//CCI Values

double C_CCI=iCCI(NULL,0,48,PRICE_TYPICAL,0);

double P_CCI=iCCI(NULL,0,48,PRICE_TYPICAL,1);

//ADX Values

double ADX_main=iADX(NULL,0,adx1,PRICE_TYPICAL,MODE_MAIN,0);

double PrevADX_main=iADX(NULL,0,adx1,PRICE_TYPICAL,MODE_MAIN,1);

double ADX_plus=iADX(NULL,0,adx1,PRICE_TYPICAL,MODE_PLUSDI,0);

double PrevADX_plus=iADX(NULL,0,adx1,PRICE_TYPICAL,MODE_PLUSDI,1);

double ADX_minus=iADX(NULL,0,adx1,PRICE_TYPICAL,MODE_MINUSDI,0);

double PrevADX_minus=iADX(NULL,0,adx1,PRICE_TYPICAL,MODE_MINUSDI,1);

//MACD Values

double MACD_main=iMACD(NULL,0,mfast,mslow,msig,PRICE_TYPICAL,MODE_MAIN,0);

double MACD_sig=iMACD(NULL,0,mfast,mslow,msig,PRICE_TYPICAL,MODE_SIGNAL,0);

double PrevMACD_main=iMACD(NULL,0,mfast,mslow,msig,PRICE_TYPICAL,MODE_MAIN,1);

double PrevMACD_sig=iMACD(NULL,0,mfast,mslow,msig,PRICE_TYPICAL,MODE_SIGNAL,1);

//ECO values

double RedECO=NormalizeDouble(iCustom(NULL,0,"ECO_SplitTest3",ECO1,ECO2,0,0),0);//red line from indie

double PRedECO=NormalizeDouble(iCustom(NULL,0,"ECO_SplitTest3",ECO1,ECO2,0,1),0);//previous red line from indie

double GreenECO=NormalizeDouble(iCustom(NULL,0,"ECO_SplitTest3",ECO1,ECO2,4,0),0);//green line from indie

double PGreenECO=NormalizeDouble(iCustom(NULL,0,"ECO_SplitTest3",ECO1,ECO2,4,1),0);//previous green line from indie

double ECO=NormalizeDouble(iCustom(NULL,0,"ECO_SplitTest3",ECO1,ECO2,2,0),1);//current ECO value

double PrevECO=NormalizeDouble(iCustom(NULL,0,"ECO_SplitTest3",ECO1,ECO2,2,1),1);//previous ECO value

//IFT values

double ITrig=iCustom(NULL,0,"IFT",IHi,ILo,RsiB,WmaB,1,1);//IFT Line

double PITrig=iCustom(NULL,0,"IFT",IHi,ILo,RsiB,WmaB,1,2);//IFT Line

//*********************************************************************************

//*********************** INDICATOR TRIGGERS ************************************

//*********************************************************************************

//RSI Triggers

if(RSI_1>30 && RSI_2<30 && RSI_1>RSI_2 && PrevRSI_1<30 && PrevRSI_2<30) RSI_long=true; else RSI_long=false;

if(RSI_1<70 && RSI_2>70 && RSI_1<RSI_2 && PrevRSI_1>70 && PrevRSI_2>70) RSI_short=true; else RSI_short=false;

//CCI Triggers

if(C_CCI>P_CCI) CCI_long=true; else CCI_long=false;

if(C_CCI<P_CCI) CCI_short=true; else CCI_short=false;

//ADX Triggers

if(ADX_main>=30 && ADX_main<=PrevADX_main && ADX_minus<=PrevADX_minus && ADX_minus>ADX_plus) ADX_long=true; else ADX_long=false;

if(ADX_main>=30 && ADX_main<=PrevADX_main && ADX_plus<=PrevADX_plus && ADX_plus>ADX_minus) ADX_short=true; else ADX_short=false;

//MACD Triggers

if(MACD_main > PrevMACD_main && MACD_sig>PrevMACD_sig) MACD_long=true; else MACD_long=false;

if(MACD_main < PrevMACD_main && MACD_sig<PrevMACD_sig) MACD_short=true; else MACD_short=false;

//ECO Triggers

if(ECO>PrevECO) ECO_long=true; else ECO_long=false;

if(ECO<PrevECO) ECO_short=true; else ECO_short=false;

//IFT Triggers

if(ITrig<ILo && ITrig>PITrig) IFT_long=true; else IFT_long=false;

if(ITrig>IHi && ITrig<PITrig) IFT_short=true; else IFT_short=false;

//Tunnel Triggers (in the tunnel or not -- current chart 62/169 and 1 hour e62/e169)

if(High[1]>=E62 && Low[1]<=E62) C_tunn62=True; else C_tunn62=False; //At current 62 ema

if(High[1]>=H62 && Low[1]<=H62) H_tunn62=True; else H_tunn62=False; //At 1 hour 62 ema

if(High[1]>=E169 && Low[1]<=E169) C_tunn169=True; else C_tunn169=False; //At current 169 ema

if(High[1]>=H169 && Low[1]<=H169) H_tunn169=True; else H_tunn169=False; //At 1 hour 169 ema

//*********************************************************************************

//************************* TIME TO DO SOMETHING **********************************

//*********************************************************************************

if(RSI_long==True && CCI_long==True && ADX_long==True && MACD_long==True && ECO_long==True && IFT_long==True) Ltrigger=True; else Ltrigger=False;

if(RSI_short==True && CCI_short==True && ADX_short==True && MACD_short==True && ECO_short==True && IFT_short==True) Strigger=True; else Strigger=False;

if(Ltrigger==True) up=True; else up=False;

if(Strigger==True) down=True; else down=False;

if(OT<1 && TT==True) //Are any orders open already?

{

//SHORT ENTRY

if(down==True && IsTradeAllowed()==True && TimeCurrent()>time+900)

{

int shortticket=OrderSend(Symbol(),OP_SELL,lots,Bid,slippage,SNSL,SNTP,"Short Order Being Placed ",magicnumber,0,Red);

if(shortticket<0)

{

Print("Short Order Send failed - error #",GetLastError());

}

if(shortticket>0)

{

if(OrderSelect(shortticket,SELECT_BY_TICKET,MODE_TRADES))

entry=OrderOpenPrice();

time=TimeCurrent();

Print("SELL order opened : ",OrderOpenPrice(),"|| Target Price : ",entry-scalp);

}

return(0);

}

//LONG ENTRY

if(up==True && IsTradeAllowed()==True && TimeCurrent()>time+900)

{

int longticket=OrderSend(Symbol(),OP_BUY,lots,Ask,slippage,LNSL,LNTP,"Long Order Being Placed ",magicnumber,0,Green);

if(longticket<0)

{

Print("Long Order Send failed - error #",GetLastError());

}

if(longticket>0)

{

if(OrderSelect(longticket,SELECT_BY_TICKET,MODE_TRADES))

entry=OrderOpenPrice();

time=TimeCurrent();

Print("BUY order opened : ",OrderOpenPrice(),"|| Target Price : ",entry+scalp);

}

return(0);

}

return(0);

}

//************** Close Orders ***********************

for(int cnt=0;cnt<OT;cnt++)

{

OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);

if(OrderMagicNumber()==magicnumber)

{

if(OrderType()==OP_BUY && TimeCurrent()>time+300) // long position is open

{

if(Bid>=entry+scalp)

{

OrderClose(OrderTicket(),OrderLots(),Bid,slippage,Blue);

return(0);

}

}

if(OrderType()==OP_SELL && TimeCurrent()>time+300) // short position is open

{

if(Ask<=entry-scalp)

{

OrderClose(OrderTicket(),OrderLots(),Ask,slippage,Blue);

return(0);

}

}

}

}

return(0);

}

Check your email Sherri. This is from a 2 day test on 5 min beast with just 10k units.