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.
My favorite trades for the week starting 4-29 (prices based on Friday close 4-26-13):
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;
Cool whatever, I certainly don't have all the answers but maybe in time some more folks will join and contribute their knowledge too. Gann is some pretty timeless stuff and as much as I try to apply it it FX it just doesn't make as much sense because of the decimals and the minimum price steps and the zero sum nature of it. Calculated some interesting sq9 stuff with some of the yen crosses but then the same methodology didn't seem to apply to stuff like au or gu so I just decided to see if I could use it as intended. Gann did a lot of stuff and my favorite is the square of 9 and most of my charts are related to it in terms of time cycles
Hey Git, visiting from Simple's board, will be sure to check out what you have going on.
So no new high for AMCX on day 101 which means that around the square of nine we go and higher still. Monday 4-15-13 is day 106 which has already proven to be a key angle and with 53 in the mix already too it should be dramatic sell off me thinks on any new high on Monday
Here's a pretty datailed look at CONN times from a SQ9 perspective using Gannzilla. Could be something coming up in 8 days when the 150 degree 3.12 to current timeframe aligns with the 289 day 135 degree mark. Have to check the prices to be sure, right now the 856 day is exactly 180 degrees. Pretty amazing that the 2-1-2006 high was exactly 360 degrees from the 11-25-2003 incorporation date.
Welcome! This board is for all things Gann style!
Here's a great link to some trailing stop methods for MT4. It's the 5th post down.
http://www.forex-tsd.com/expert-advisors-metatrader-4/58-trailing-stop-ea.html
MT5 beta release is scheduled for late June I believe. Here's a link to some screenshots.
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!
ROFLMAO - hey, I hate to say it, but I am glad you didn't find it right off because I would have felt stupid. Going to look at it again in a bit - just got back from lunch....
LOL, don't mind tellin ya this is taxing the sheet outta my feeble mind!
Solve my error and then worry about it - LOL!
I have decided that it is not possible to use ObjectGetValueByShift with a regression line in MT4.
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
Check your e-mail....results looking really solid except for a couple of runs where we really should have SOME kind of stop loss in place....some of them were actually 100% though....and not just on a week or day worth either
Yes you are right, eventually I was going to put a case statement where if the chart was a 5 minute then time="whatever" and so forth. After looking at all my EAs, my worst fear is it trading too much and making the wrong decision 10 dang times or more while I'm at work. Been thinking about coding something of a safety net where if it loses a certain percentage of my account value or makes three wrong trades in a day then it shuts down so I can figure out what went wrong fore I lose all my cash.
Looking forward to seeing your approach Sherri!
The only catch with that is, depending on the chart time frame, you may not execute enough....(or too much).
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.
This is what I am using Sherri, when I was using strictly indicators I found that sometimes the EA would execute multiple times 20 seconds apart or so. I set the time variable at init and then flag it after every trade. I have it set here for a min of 900 seconds (15 minutes) between trades.
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);
}
Here is a good one....I want a certain portion of my EA to only execute once per candle and not on every tick. I know I can take the current time and subtract the open time of the candle and check for how many seconds it is, but unless there is lots of volume, that can leave me vulnerable for it not executing....
ahh wait....another stupid idea, but it should work
I have a more simple formula than that...two actually....will post it ASAP (it isn't physically with me)
Another extraordinary thought I have is to code the standard deviation channels based upon an ema, perhaps the 20 at first thought. Just thinkin out loud here, but the right ema for the SD would probably result in the e62 at the lower channel if uptrend or the upper channel if in a downtrend. That way you wouldn't have to worry so much about the 56 bar lookback and it would "flex" with the ema trend.
I'll try this as soon as I get the chance, been more than 20 years since I took calculus...lol...I hated it too BTW because I knew that I knew so much that I would never need to know it lmao.
----------------------------------------------------
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.
Yup, I believe this thought process should work. The lines are essentially 1 and 2 standard deviations above and below the central trendline so if you were to take the beginning and end points of the central line then move those points up and down 1 and 2 std deviations then draw a trend line between the upper points and a trendline between the lower points it should be possible to access the values of each trend line along the length. Maybe they'll address each line of the regression channel in MT5, but I'm pretty sure that should be a functional workaround.
Just got home and going back to work in the morning so it'll have to wait until I've got more time.
My thought is more simple than that....find a solid RLI calculation or indie, and simply add the widths we see on the good SDC indie we have, saving and/or updating an array as we go, and then compare it against the price.
I'm working this afternoon too...
Thoughts on the SDC indicator
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
I've gone code crazy here! 270 lines and counting. I've combined 7 different indicators here for a try at reducing the false entries. You can remove any indicator by removing the boolean from the trigger sequence right below the "TIME TO DO SOMETHING" line. I'm sure it's too tight to make a trade, but it's a great template for tweaking.
//+------------------------------------------------------------------+
//| 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.
They're coming along pretty good. Was going to send you a setup last night but my sister in law and her family are here for the weekend and I didn't get to finish tweaking it. Try to email it to you sometime this weekend.