Adding reversal after trade goes past stoch50
  #1 (permalink)  
Old 08-03-2005, 02:31 PM
Sophomore
 
Join Date: Jul 2005
Posts: 60
Thanks: 8
Thanked 20 Times in 9 Posts
TurboTrader24 is a jewel in the roughTurboTrader24 is a jewel in the roughTurboTrader24 is a jewel in the roughTurboTrader24 is a jewel in the rough
Default Adding reversal after trade goes past stoch50

Here is what I am trying to do on my code if on fresh open trade the narket goes the other direction i want to add a reversal so that on buy if the stoch goes below 50 it will reverse on sell if the stoch goes above 50 it will buy

And when the wma amd sma cross it will close the trade on wma 5 and 6
I just can't figure out the logics to put in ZeroCode :sweatdrop
Thanks again
Turbo_Trader

My Code


Thanks Much
Mike


My code also can you make shure I addid the pip filter correctly


//*---------------------------------------------------------------------------------------------------------*\
// This MQL is automatically generated by FXFisherman ZeroCode v1.0.2014.30845 (www.fxfisherman.com)
//
// DISCLAIMER:
//
// FXFisherman ZeroCode is provided free of charge, and, therefore, on an "as is" basis, without warranty
// of any kind, express or implied, including without limitation the warranties that it is free of defects,
// virus free, able to operate on an uninterrupted basis, merchantable, fit for a particular purpose or
// non-infringing. In any case, the author(s) will not be responsible or liable for ANY SPECIAL, INCIDENTAL,
// CONSEQUENTIAL, INDIRECT OR ANY OTHER LOSSES caused by using of this software. USE IT AT YOUR OWN RISK.
//
//*-----------------------------------PLEASE DO NOT REMOVE THIS HEADER--------------------------------------*/

/*[[
Name := Turbo_Trader1.2
Author := Mike Mckeough
Link := Coded_by_FXFisherman_ZeroCode_@www.fxfisherman.com
Lots := 1
Stop Loss := 0
Take Profit := 499
Trailing Stop := 10
]]*/
defines: Slippage(3);
defines: ;
var: cnt(0),IsBuying(False),IsSelling(False),IsClosing( False),RealTP(0),RealSL(0);
var: rsi3_1(0),rsi3_0(0),stoc4d_1(0),stoc4d_0(0),stoc4k _1(0),stoc4k_0(0),ma1_1(0),ma1_0(0),ma6_1(0),ma6_0 (0),ma5_1(0),ma5_0(0),ma2_1(0),ma2_0(0);

// Check for invalid bars and takeprofit
If Bars<200 then Exit;

// Calculate indicators' value
rsi3_1 = iRSI(19,1);
rsi3_0 = iRSI(19,0);
stoc4d_1 = iSTO(4,2,2,MODE_SMA,MODE_SIGNAL,1);
stoc4d_0 = iSTO(4,2,2,MODE_SMA,MODE_SIGNAL,0);
stoc4k_1 = iSTO(4,2,2,MODE_SMA,MODE_MAIN,1);
stoc4k_0 = iSTO(4,2,2,MODE_SMA,MODE_MAIN,0);
ma1_1 = iMAEx(3,MODE_LWMA,0,PRICE_CLOSE,1);
ma1_0 = iMAEx(3,MODE_LWMA,0,PRICE_CLOSE,0);
ma6_1 = iMAEx(4,MODE_SMA,0,PRICE_CLOSE,1);
ma6_0 = iMAEx(4,MODE_SMA,0,PRICE_CLOSE,0);
ma5_1 = iMAEx(5,MODE_LWMA,0,PRICE_CLOSE,1);
ma5_0 = iMAEx(5,MODE_LWMA,0,PRICE_CLOSE,0);
ma2_1 = iMAEx(3,MODE_SMA,0,PRICE_CLOSE,1);
ma2_0 = iMAEx(3,MODE_SMA,0,PRICE_CLOSE,0);

// Note the bid price at crossover point
defines: FilterPips(0.0003);
var: CrossBid(0),IsBuyingBak(False),IsSellingBak(False) ;
// Check for BUY, SELL, and CLOSE signal
IsBuying = (ma1_1 <= ma2_1)
and (ma1_0 > ma2_0)
and (rsi3_0 > 60)
and (stoc4d_0 > 50);
IsSelling = (ma1_1 >= ma2_1)
and (ma1_0 < ma2_0)
and (rsi3_0 < 45)
and (stoc4d_0 < 63);
// Closing Trade On Cross On WMA SMA
IsClosing = (ma5_1 >= ma6_1)
(ma5_1 <= ma6_1)
);

// Check price filter
if (IsBuying and not IsBuyingBak) or (IsSelling and Not IsSellingBak ) then {
CrossBid = pricebid ;
}
IsBuyingBak = IsBuying;
IsSellingBak = IsSelling;
IsBuying = IsBuying and (PriceBid >= CrossBid + FilterPips);
IsSelling = IsSelling and (PriceBid <= CrossBid - FilterPips);


// Control open trades
for cnt=1 to TotalTrades
{
// Control only market trades not entry order
if OrderValue(cnt,VAL_TYPE)<=OP_SELL and
OrderValue(cnt,VAL_SYMBOL)=Symbol then
{

// Check for close signal for bought trade
If OrderValue(cnt,VAL_TYPE)=OP_BUY then
{

If IsSelling or IsClosing then
{
// Close bought trade
CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(c nt,VAL_LOTS),Bid,3,Violet);
Alert("Turbo_Trader1.2: Closing BUY order.");
};

// Check trailing stop
If TrailingStop>0 then
{
If (Bid-OrderValue(cnt,VAL_OPENPRICE))>(Point*TrailingStop ) then
{
If OrderValue(cnt,VAL_STOPLOSS)<(Bid-Point*TrailingStop) then
{
// Modify trailing stop
ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue( cnt,VAL_OPENPRICE),
Bid-Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT), Red);
};
};
};
}
else
{

// Check sold trade for close signal
If IsBuying or IsClosing then
{
CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(c nt,VAL_LOTS),Ask,3,Violet);
Alert("Turbo_Trader1.2: Closing SELL order.");
};

// Control trailing stop
If TrailingStop>0 then
{
If (OrderValue(cnt,VAL_OPENPRICE)-Ask)>(Point*TrailingStop) then
{
If OrderValue(cnt,VAL_STOPLOSS)=0 or
OrderValue(cnt,VAL_STOPLOSS)>(Ask+Point*TrailingSt op) then
{
ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue( cnt,VAL_OPENPRICE),
Ask+Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROF IT),Red);
};
};
};
};
};
};


// If there is no open trade
If TotalTrades<1 then
{
// If we have enough money for 1 lot
If FreeMargin<1000 then Exit;

// Check for BUY entry signal
If IsBuying and IsSelling=False and IsClosing=False then
{
// Buy
If StopLoss>0 then
{
RealSL=Ask-StopLoss*Point;
}
If TakeProfit>0 then
{
RealTP=Ask+TakeProfit*Point;
}
SetOrder(OP_BUY,Lots,Ask, Slippage,RealSL,RealTP,RED);
Alert("Turbo_Trader1.2: Buying");
};

// Check for SELL entry signal
If IsSelling and IsBuying=False and IsClosing=False then
{
// Sell
If StopLoss>0 then
{
RealSL=Bid+StopLoss*Point;
}
If TakeProfit>0 then
{
RealTP=Bid-TakeProfit*Point;
}
SetOrder(OP_SELL,Lots,Bid,Slippage,RealSL,RealTP,R ED);
Alert("Turbo_Trader1.2: Selling");
};
};


//-------------- Coded by FXFisherman ZeroCode v1.0.2014.30845
Reply With Quote
  #2 (permalink)  
Old 08-04-2005, 03:36 AM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,974
Thanks: 119
Thanked 383 Times in 152 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default

Add below to BUY LOGICS:

OR TotalTrades > 0
AND Stoc (x) %D Current > 50


Add below to SELL LOGICS:

OR TotalTrades > 0
AND Stoc (x) %D Current < 50

Cheers!

*Note: do you use stoch %D or %K ? Be careful with this!
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
  #3 (permalink)  
Old 08-04-2005, 03:38 AM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,974
Thanks: 119
Thanked 383 Times in 152 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default

And congrats! you successfully hacked the pip filter thing.
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
  #4 (permalink)  
Old 08-04-2005, 03:41 AM
Sophomore
 
Join Date: Jul 2005
Posts: 60
Thanks: 8
Thanked 20 Times in 9 Posts
TurboTrader24 is a jewel in the roughTurboTrader24 is a jewel in the roughTurboTrader24 is a jewel in the roughTurboTrader24 is a jewel in the rough
Default

Quote:
Originally Posted by scorpion
Add below to BUY LOGICS:

OR TotalTrades > 0
AND Stoc (x) %D Current > 50


Add below to BUY LOGICS:

OR TotalTrades > 0
AND Stoc (x) %D Current < 50

Cheers!
Thanks For all your help this code is going to be a goos one I hope but i do beleive I just wanted to verify on this you put add below to buy logics on both did you mean buy on one and sell on the other????

Hey thanks again Scorion I appreciate your help....

TurboTrader
Reply With Quote
  #5 (permalink)  
Old 08-04-2005, 05:47 AM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,974
Thanks: 119
Thanked 383 Times in 152 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default

My bad, but I corrected the post already. So check it again The last one applies to SELL.
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
  #6 (permalink)  
Old 08-04-2005, 04:40 PM
Sophomore
 
Join Date: Jul 2005
Posts: 60
Thanks: 8
Thanked 20 Times in 9 Posts
TurboTrader24 is a jewel in the roughTurboTrader24 is a jewel in the roughTurboTrader24 is a jewel in the roughTurboTrader24 is a jewel in the rough
Default

Quote:
Originally Posted by scorpion
My bad, but I corrected the post already. So check it again The last one applies to SELL.

Thanks Scorpion all is working except for some reason the parobolic is not closing trades on the first new dot in the opposite direction The backtest is showing a 5500.00 profit on eur/usd but it seems to be missing alot of trades due to the parabolic bar not closing previous trades.... :sweatdrop

See Code

//*---------------------------------------------------------------------------------------------------------*\
// This MQL is automatically generated by FXFisherman ZeroCode v1.0.2014.30845 (www.fxfisherman.com)
//
// DISCLAIMER:
//
// FXFisherman ZeroCode is provided free of charge, and, therefore, on an "as is" basis, without warranty
// of any kind, express or implied, including without limitation the warranties that it is free of defects,
// virus free, able to operate on an uninterrupted basis, merchantable, fit for a particular purpose or
// non-infringing. In any case, the author(s) will not be responsible or liable for ANY SPECIAL, INCIDENTAL,
// CONSEQUENTIAL, INDIRECT OR ANY OTHER LOSSES caused by using of this software. USE IT AT YOUR OWN RISK.
//
//*-----------------------------------PLEASE DO NOT REMOVE THIS HEADER--------------------------------------*/

/*[[
Name := TurboTrader2.0
Author := Mike McKeough
Link := Coded_by_FXFisherman_ZeroCode_@www.fxfisherman.com
Lots := 1
Stop Loss := 0
Take Profit := 499
Trailing Stop := 25
]]*/
defines: Slippage(3);
defines: ;
var: cnt(0),IsBuying(False),IsSelling(False),IsClosing( False),RealTP(0),RealSL(0);
var: rsi3_1(0),rsi3_0(0),stoc4d_1(0),stoc4d_0(0),stoc4k _1(0),stoc4k_0(0),ma1_1(0),ma1_0(0),sar5_1(0),sar5 _0(0),ma2_1(0),ma2_0(0);

// Check for invalid bars and takeprofit
If Bars<200 then Exit;

// Calculate indicators' value
rsi3_1 = iRSI(24,1);
rsi3_0 = iRSI(24,0);
stoc4d_1 = iSTO(4,2,2,MODE_SMA,MODE_SIGNAL,1);
stoc4d_0 = iSTO(4,2,2,MODE_SMA,MODE_SIGNAL,0);
stoc4k_1 = iSTO(4,2,2,MODE_SMA,MODE_MAIN,1);
stoc4k_0 = iSTO(4,2,2,MODE_SMA,MODE_MAIN,0);
ma1_1 = iMAEx(3,MODE_LWMA,0,PRICE_CLOSE,1);
ma1_0 = iMAEx(3,MODE_LWMA,0,PRICE_CLOSE,0);
sar5_1 = iSAR(0.0650,0.3000,1);
sar5_0 = iSAR(0.0650,0.3000,0);
ma2_1 = iMAEx(4,MODE_EMA,0,PRICE_CLOSE,1);
ma2_0 = iMAEx(4,MODE_EMA,0,PRICE_CLOSE,0);

// Note the bid price at crossover point
defines: FilterPips(0.0006);
var: CrossBid(0),IsBuyingBak(False),IsSellingBak(False) ;


// Check for BUY, SELL, and CLOSE signal
IsBuying = (ma1_1 <= ma2_1)
and (ma1_0 > ma2_0)
and (rsi3_0 > 50)
and (stoc4d_0 < 50)
or (TotalTrades > 0)
and (stoc4d_0 < 50);
IsSelling = (ma1_1 >= ma2_1)
and (ma1_0 < ma2_0)
and (rsi3_0 < 50)
and (stoc4d_0 < 50)
or (TotalTrades < 0)
and (stoc4d_0 < 50);
IsClosing = (sar5_1 >= High[1])
and (sar5_0 <= Low[0])
or (sar5_1 <= Low[1])
and (sar5_0 >= High[0]);

// Check price filter
if (IsBuying and not IsBuyingBak) or (IsSelling and Not IsSellingBak ) then { CrossBid = pricebid ;
}
IsBuyingBak = IsBuying;
IsSellingBak = IsSelling;
IsBuying = IsBuying and (PriceBid >= CrossBid + FilterPips);
IsSelling = IsSelling and (PriceBid <= CrossBid - FilterPips);

// Control open trades
for cnt=1 to TotalTrades
{
// Control only market trades not entry order
if OrderValue(cnt,VAL_TYPE)<=OP_SELL and
OrderValue(cnt,VAL_SYMBOL)=Symbol then
{

// Check for close signal for bought trade
If OrderValue(cnt,VAL_TYPE)=OP_BUY then
{

If IsSelling or IsClosing then
{
// Close bought trade
CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(c nt,VAL_LOTS),Bid,3,Yellow);
Alert("TurboTrader2.0: Closing BUY order.");
};

// Check trailing stop
If TrailingStop>0 then
{
If (Bid-OrderValue(cnt,VAL_OPENPRICE))>(Point*TrailingStop ) then
{
If OrderValue(cnt,VAL_STOPLOSS)<(Bid-Point*TrailingStop) then
{
// Modify trailing stop
ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue( cnt,VAL_OPENPRICE),
Bid-Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT), Red);
};
};
};
}
else
{

// Check sold trade for close signal
If IsBuying or IsClosing then
{
CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(c nt,VAL_LOTS),Ask,3,Yellow);
Alert("TurboTrader2.0: Closing SELL order.");
};

// Control trailing stop
If TrailingStop>0 then
{
If (OrderValue(cnt,VAL_OPENPRICE)-Ask)>(Point*TrailingStop) then
{
If OrderValue(cnt,VAL_STOPLOSS)=0 or
OrderValue(cnt,VAL_STOPLOSS)>(Ask+Point*TrailingSt op) then
{
ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue( cnt,VAL_OPENPRICE),
Ask+Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROF IT),Red);
};
};
};
};
};
};


// If there is no open trade
If TotalTrades<1 then
{
// If we have enough money for 1 lot
If FreeMargin<1000 then Exit;

// Check for BUY entry signal
If IsBuying and IsSelling=False and IsClosing=False then
{
// Buy
If StopLoss>0 then
{
RealSL=Ask-StopLoss*Point;
}
If TakeProfit>0 then
{
RealTP=Ask+TakeProfit*Point;
}
SetOrder(OP_BUY,Lots,Ask, Slippage,RealSL,RealTP,Blue);
Alert("TurboTrader2.0: Buying");
};

// Check for SELL entry signal
If IsSelling and IsBuying=False and IsClosing=False then
{
// Sell
If StopLoss>0 then
{
RealSL=Bid+StopLoss*Point;
}
If TakeProfit>0 then
{
RealTP=Bid-TakeProfit*Point;
}
SetOrder(OP_SELL,Lots,Bid,Slippage,RealSL,RealTP,R ED);
Alert("TurboTrader2.0: Selling");
};
};


//-------------- Coded by FXFisherman ZeroCode v1.0.2014.30845



Thanks Scorpion
Reply With Quote
  #7 (permalink)  
Old 08-04-2005, 05:26 PM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,974
Thanks: 119
Thanked 383 Times in 152 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default

About reversal, you incorrectly added the logics to BUY and SELL. Again, carefully add the logics and watch out for > and < signs.

About sar, did you find the problem with backtesting or live testing? If problems with backtesting then it must be the bugs in MetaTrader itself, not your expert advisor.

Hey, I suggest you use punctuation like period ( . ) comma ( , ) semicolon ( ; ) in your English writing, you know. Doing this would make your writing easy to read and understand.
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
  #8 (permalink)  
Old 08-04-2005, 05:54 PM
Sophomore
 
Join Date: Jul 2005
Posts: 60
Thanks: 8
Thanked 20 Times in 9 Posts
TurboTrader24 is a jewel in the roughTurboTrader24 is a jewel in the roughTurboTrader24 is a jewel in the roughTurboTrader24 is a jewel in the rough
Default

Quote:
Originally Posted by scorpion
About reversal, you incorrectly added the logics to BUY and SELL. Again, carefully add the logics and watch out for > and < signs.

About sar, did you find the problem with backtesting or live testing? If problems with backtesting then it must be the bugs in MetaTrader itself, not your expert advisor.

Hey, I suggest you use punctuation like period ( . ) comma ( , ) semicolon ( ; ) in your English writing, you know. Doing this would make your writing easy to read and understand.

Thanks it must be MT on the back test. I see what you mean on the wrong logics I did.
Thanks Again,
Mike
Reply With Quote
  #9 (permalink)  
Old 08-04-2005, 06:10 PM
scorpion's Avatar
Administrator
 
Join Date: Aug 2004
Posts: 1,974
Thanks: 119
Thanked 383 Times in 152 Posts
scorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to beholdscorpion is a splendid one to behold
Send a message via MSN to scorpion Send a message via Yahoo to scorpion
Default

Yeah post message with puntuation dude!
__________________
Make easy pips with the Advanced Economic Calendar for Forex Trading.
Reply With Quote
RE Verify
  #10 (permalink)  
Old 08-05-2005, 04:01 AM
Sophomore
 
Join Date: Jul 2005
Posts: 60
Thanks: 8
Thanked 20 Times in 9 Posts
TurboTrader24 is a jewel in the roughTurboTrader24 is a jewel in the roughTurboTrader24 is a jewel in the roughTurboTrader24 is a jewel in the rough
Thumbs up RE Verify

Scorpion, here is my code can you verify????? It still does not close the Parabolic, even in A forward test..... Also I wrote to Gordago to see if he would send us 2 copies of the MT-4 Editor . If he does I will send ya the code, to make it usable, for all the help you have given me and others...

Hope He Sends It

Thanks Dude

TurboTrader


//*---------------------------------------------------------------------------------------------------------*\
// This MQL is automatically generated by FXFisherman ZeroCode v1.0.2014.30845 (www.fxfisherman.com)
//
// DISCLAIMER:
//
// FXFisherman ZeroCode is provided free of charge, and, therefore, on an "as is" basis, without warranty
// of any kind, express or implied, including without limitation the warranties that it is free of defects,
// virus free, able to operate on an uninterrupted basis, merchantable, fit for a particular purpose or
// non-infringing. In any case, the author(s) will not be responsible or liable for ANY SPECIAL, INCIDENTAL,
// CONSEQUENTIAL, INDIRECT OR ANY OTHER LOSSES caused by using of this software. USE IT AT YOUR OWN RISK.
//
//*-----------------------------------PLEASE DO NOT REMOVE THIS HEADER--------------------------------------*/

/*[[
Name := TurboTrader5.3
Author := Mike McKeough
Link := Coded_by_FXFisherman_ZeroCode_@www.fxfisherman.com
Lots := 1
Stop Loss := 0
Take Profit := 499
Trailing Stop := 25
]]*/
defines: Slippage(3);
defines: ;
var: cnt(0),IsBuying(False),IsSelling(False),IsClosing( False),RealTP(0),RealSL(0);
var: rsi3_1(0),rsi3_0(0),stoc4d_1(0),stoc4d_0(0),stoc4k _1(0),stoc4k_0(0),ma1_1(0),ma1_0(0),sar5_1(0),sar5 _0(0),rsi6_1(0),rsi6_0(0),ma7_1(0),ma7_0(0),ma2_1( 0),ma2_0(0);

// Check for invalid bars and takeprofit
If Bars<200 then Exit;

// Calculate indicators' value
rsi3_1 = iRSI(24,1);
rsi3_0 = iRSI(24,0);
stoc4d_1 = iSTO(4,2,2,MODE_SMA,MODE_SIGNAL,1);
stoc4d_0 = iSTO(4,2,2,MODE_SMA,MODE_SIGNAL,0);
stoc4k_1 = iSTO(4,2,2,MODE_SMA,MODE_MAIN,1);
stoc4k_0 = iSTO(4,2,2,MODE_SMA,MODE_MAIN,0);
ma1_1 = iMAEx(3,MODE_LWMA,0,PRICE_CLOSE,1);
ma1_0 = iMAEx(3,MODE_LWMA,0,PRICE_CLOSE,0);
sar5_1 = iSAR(0.0650,0.3000,1);
sar5_0 = iSAR(0.0650,0.3000,0);
rsi6_1 = iRSI(10,1);
rsi6_0 = iRSI(10,0);
ma7_1 = iMAEx(4,MODE_SMA,0,PRICE_CLOSE,1);
ma7_0 = iMAEx(4,MODE_SMA,0,PRICE_CLOSE,0);
ma2_1 = iMAEx(4,MODE_EMA,0,PRICE_CLOSE,1);
ma2_0 = iMAEx(4,MODE_EMA,0,PRICE_CLOSE,0);


// Check for BUY, SELL, and CLOSE signal
IsBuying = (ma1_1 <= ma2_1)
and (ma1_0 > ma2_0)
and (rsi3_0 > 40)
and (stoc4d_0 > 50)
or (TotalTrades > 0)
and (stoc4d_0 > 50);
IsSelling = (ma1_1 >= ma2_1)
and (ma1_0 < ma2_0)
and (stoc4d_0 < 50)
and (rsi6_1 < 56)
or (TotalTrades > 0)
and (stoc4d_0 < 50);
IsClosing = (sar5_1 >= High[1])
and (sar5_0 <= Low[0])
or (sar5_1 <= Low[1])
and (sar5_0 >= High[0]);

// Control open trades
for cnt=1 to TotalTrades
{
// Control only market trades not entry order
if OrderValue(cnt,VAL_TYPE)<=OP_SELL and
OrderValue(cnt,VAL_SYMBOL)=Symbol then
{

// Check for close signal for bought trade
If OrderValue(cnt,VAL_TYPE)=OP_BUY then
{

If IsSelling or IsClosing then
{
// Close bought trade
CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(c nt,VAL_LOTS),Bid,3,Violet);
Alert("TurboTrader5.3: Closing BUY order.");
};

// Check trailing stop
If TrailingStop>0 then
{
If (Bid-OrderValue(cnt,VAL_OPENPRICE))>(Point*TrailingStop ) then
{
If OrderValue(cnt,VAL_STOPLOSS)<(Bid-Point*TrailingStop) then
{
// Modify trailing stop
ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue( cnt,VAL_OPENPRICE),
Bid-Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT), Red);
};
};
};
}
else
{

// Check sold trade for close signal
If IsBuying or IsClosing then
{
CloseOrder(OrderValue(cnt,VAL_TICKET),OrderValue(c nt,VAL_LOTS),Ask,3,Violet);
Alert("TurboTrader5.3: Closing SELL order.");
};

// Control trailing stop
If TrailingStop>0 then
{
If (OrderValue(cnt,VAL_OPENPRICE)-Ask)>(Point*TrailingStop) then
{
If OrderValue(cnt,VAL_STOPLOSS)=0 or
OrderValue(cnt,VAL_STOPLOSS)>(Ask+Point*TrailingSt op) then
{
ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue( cnt,VAL_OPENPRICE),
Ask+Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROF IT),Red);
};
};
};
};
};
};


// If there is no open trade
If TotalTrades<1 then
{
// If we have enough money for 1 lot
If FreeMargin<1000 then Exit;

// Check for BUY entry signal
If IsBuying and IsSelling=False and IsClosing=False then
{
// Buy
If StopLoss>0 then
{
RealSL=Ask-StopLoss*Point;
}
If TakeProfit>0 then
{
RealTP=Ask+TakeProfit*Point;
}
SetOrder(OP_BUY,Lots,Ask, Slippage,RealSL,RealTP,RED);
Alert("TurboTrader5.3: Buying");
};

// Check for SELL entry signal
If IsSelling and IsBuying=False and IsClosing=False then
{
// Sell
If StopLoss>0 then
{
RealSL=Bid+StopLoss*Point;
}
If TakeProfit>0 then
{
RealTP=Bid-TakeProfit*Point;
}
SetOrder(OP_SELL,Lots,Bid,Slippage,RealSL,RealTP,R ED);
Alert("TurboTrader5.3: Selling");
};
};


//-------------- Coded by FXFisherman ZeroCode v1.0.2014.30845
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Super Ea AQUILEZ Trading Systems 142 09-24-2008 01:25 PM
Crazy system to trade gbp paco246y8 System Coding 0 09-18-2006 03:45 PM


All times are GMT. The time now is 10:07 PM.
Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0

Registered members have access to special online forex currency trading tools, software, mt4 expert advisors and indicators. Register now

Main Menu

Economic Forecast