Sell with SL and TP





//+------------------------------------------------------------------+
//|                                              Sell with SL and TP |
//|                               Copyright © 2008, smjones          |
//|                                               sjcoinc            |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, smjones"
#property link      "sjcoinc2000@yahoo.com"



#property show_inputs

extern bool OpenSecondPosition = true;
extern double Lots1 = 0.3;
extern double Lots2 = 0.7;
extern bool   UseMoneyMgmt = false;
extern double RiskPercent1 = 1.2;
extern double RiskPercent2 = 0.8;
extern bool   UseStop1 = true;
extern bool   UseTakeProfit1 = true;
extern bool   UseStop2 = true;
extern bool   UseTakeProfit2 = true;
extern double StopLoss1 = 1000;
extern double StopLoss2 = 1000;
extern double TakeProfit1 = 250;
extern double TakeProfit2 = 150;
extern string Note="0 in Entry field means Market Order Sell";
extern double Entry = 0.0000;

string Input = " Sell Price ";




//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
  double Risk1 = RiskPercent1 / 100;
  double Risk2 = RiskPercent2 / 100;
  if (UseMoneyMgmt)
  {  
   Lots1 = NormalizeDouble( AccountBalance()*Risk1/StopLoss1/(MarketInfo(Symbol(), MODE_TICKVALUE)),2);
   Lots2 = NormalizeDouble( AccountBalance()*Risk2/StopLoss2/(MarketInfo(Symbol(), MODE_TICKVALUE)),2);
  } 
  int Mode = OP_SELLSTOP;
  if (Bid < Entry && Entry > 0) Mode = OP_SELLLIMIT; 
  if (Entry == 0)  {Entry = Bid; Mode = OP_SELL;}
  double  SLS1 = Entry+StopLoss1*Point, TPS1 = Entry - TakeProfit1 * Point;
  if (UseStop1 == false) SLS1 = 0;
  if (UseTakeProfit1 == false) TPS1 = 0;
  if(Lots1 > 0)
   OrderSend(Symbol(),Mode, Lots1, Entry, 2, SLS1, TPS1, "Sell Script 1",0, NULL, Red);

// Second Position

  if (OpenSecondPosition)
  {
    double  SLS2 = Entry+StopLoss2*Point, TPS2 = Entry - TakeProfit2 * Point;
    if (UseStop2 == false) SLS2 = 0;
    if (UseTakeProfit2 == false) TPS2 = 0;
    if(Lots2 > 0)
     OrderSend(Symbol(),Mode, Lots2, Entry, 2, SLS2, TPS2, "Sell Script 1",0, NULL, Red);
  }
            
   return(0);
  }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:



Indicator Curves created:


Indicators Used:



Custom Indicators Used:

Order Management characteristics:
It automatically opens orders when conditions are reached

Other Features:


BackTest : EURUSD on H1

From 2009-08-01 to 2009-10-01 Profit Factor:0.00 Total Net Profit:-9752.40

BackTest : EURUSD on H1

From 2009-12-01 to 2010-01-17 Profit Factor:0.00 Total Net Profit:-9612.00

BackTest : EURUSD on H1

From 2010-04-01 to 2010-04-30 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-05-01 to 2010-05-31 Profit Factor:0.00 Total Net Profit:0.00

BackTest : EURUSD on H1

From 2010-06-01 to 2010-06-30 Profit Factor:0.00 Total Net Profit:0.00

BackTest : GBPUSD on H1

From 2010-01-01 to 2010-02-27 Profit Factor:0.00 Total Net Profit:-10412.10

BackTest : USDCAD on H1

From 2009-12-01 to 2010-01-01 Profit Factor:0.00 Total Net Profit:-10010.23

BackTest : USDCHF on H1

From 2009-12-01 to 2010-01-01 Profit Factor:0.00 Total Net Profit:-15964.24

BackTest : USDJPY on H1

From 2009-11-01 to 2009-11-30 Profit Factor:0.00 Total Net Profit:-8416.66

Request Backtest for Sell with SL and TP


From : (yyyy/mm/dd) To: (yyyy/mm/dd)

Pair: Period: