easy trading

Les utilisateurs travaillent en harmonie et privilégient la discussion aussi courtoise que possible pour régler les oppositions, aussi, prenez le temps de vous y habituer.

Easy trading fournit à ses internautes des idées de trade ainsi que des analyses, mais ne pourra être tenu responsable en cas de perte. Le FOREX est un marché rendu volatil par l'effet de levier qui vous est proposé. Un risque de pertes financières importantes est toujours présent.
easy trading

Site dédié aux amateurs désireux de progresser dans le monde de la bourse, en tentant de gagner d'avantage à travers les clés fournies par l'Analyse Technique et l'Analyse comportementale des acteurs du marché.

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


Sondage

le cac le 1 aout 2010 ?

 
 
 
 
 

Voir les résultats


EMA 5 and 34 Cross Trading System

Partagez
avatar
f.guig
Admin
Admin

Messages : 441
Date d'inscription : 08/11/2009
Age : 41
Localisation : var

EMA 5 and 34 Cross Trading System

Message  f.guig le 14/3/2010, 5:14 pm

//*---------------------------------------------------------------------------------------------------------*\
// 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 := EMA 5 and 34 Cross Trading System
Author := freshfx
Link := Coded_by_FXFisherman_ZeroCode_@www.fxfisherman.com
Lots := 1
Stop Loss := 30
Take Profit := 999
Trailing Stop := 30
]]*/
defines: Slippage(3);
defines: ;
var: cnt(0),IsBuying(False),IsSelling(False),IsClosing(False),RealTP(0),RealSL(0);
var: ma1_1(0),ma1_0(0),ma2_1(0),ma2_0(0);

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

// Calculate indicators' value
ma1_1 = iMAEx(5,MODE_EMA,0,PRICE_CLOSE,1);
ma1_0 = iMAEx(5,MODE_EMA,0,PRICE_CLOSE,0);
ma2_1 = iMAEx(34,MODE_EMA,0,PRICE_CLOSE,1);
ma2_0 = iMAEx(34,MODE_EMA,0,PRICE_CLOSE,0);


// Check for BUY, SELL, and CLOSE signal
IsBuying = (ma1_1 < ma2_1)
and (ma1_0 > ma2_0);
IsSelling = (ma1_1 > ma2_1)
and (ma1_0 < ma2_0);
IsClosing = False;

// 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(cnt,VAL_LOTS),Bid,3,Violet);
Alert("EMA 5 and 34 Cross Trading System: 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(cnt,VAL_LOTS),Ask,3,Violet);
Alert("EMA 5 and 34 Cross Trading System: 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*TrailingStop) then
{
ModifyOrder(OrderValue(cnt,VAL_TICKET),OrderValue(cnt,VAL_OPENPRICE),
Ask+Point*TrailingStop,OrderValue(cnt,VAL_TAKEPROFIT),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("EMA 5 and 34 Cross Trading System: 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,RED);
Alert("EMA 5 and 34 Cross Trading System: Selling");
};
};


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

    La date/heure actuelle est 16/12/2018, 2:26 pm