Einzelnen Beitrag anzeigen
  #250 (permalink)  
Alt 04.09.16
MA-EA MA-EA ist offline
Elite Mitglied
 
Registriert seit: Sep 2015
Beiträge: 565
MA-EA befindet sich auf einem aufstrebenden Ast
Standard

Hallo.

Richtig so? (wie heißt es doch oft:Probieren geht über Studieren )

Code:
//open Long & Short
extern bool Open_long_and_Short = true;
Code:
//Open Long & Short Abkürzung
bool OLAS = (Open_long_and_Short);
Code:
//Open Trade
if (!IsInvested){
if (TC>F && TC<T && S<=MS && CP0>F_MA && CP1>F_MA && F_MA>M_MA && M_MA>S_MA) OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, 0, 0, Name + " Buy(#" + MagicNumber + ")", MagicNumber, 0, Blue);
if (OLAS=true && TC>F && TC<T && S<=MS && CP0>F_MA && CP1>F_MA && F_MA>M_MA && M_MA>S_MA) OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, 0, 0, Name + " Sell(#" + MagicNumber + ")", MagicNumber, 0, Red);

if (TC>F && TC<T && S<=MS && CP0<F_MA && CP1<F_MA && F_MA<M_MA && M_MA<S_MA) OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, 0, 0, Name + " Sell(#" + MagicNumber + ")", MagicNumber, 0, Red);
if (OLAS=true && TC>F && TC<T && S<=MS && CP0<F_MA && CP1<F_MA && F_MA<M_MA && M_MA<S_MA)  OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, 0, 0, Name + " Buy(#" + MagicNumber + ")", MagicNumber, 0, Blue);}
//-------------------------------------------------------------------------------------------------------------

//Close Trade
if (IsInvested){
for (i=OrdersTotal()-1; i>=0; i--){
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)){

if (OrderType()==OP_BUY && OrderMagicNumber()==MagicNumber && OrderSymbol()==Symbol()){
if((CP1<F_MA && F_MA<M_MA) || (CAA=true && TC>CA) || (CLTF=true && CP0<CP1 && O_P<0.0)) OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, DarkBlue);}

if (OrderType()==OP_SELL && OrderMagicNumber()==MagicNumber && OrderSymbol()==Symbol()){
if((CP1>F_MA && F_MA>M_MA) || (CAA=true && TC>CA) || (CLTF=true && CP0>CP1 && O_P<0.0)) OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, FireBrick);}}}}
//-------------------------------------------------------------------------------------------------------------

return(0);}