
//#property show_inputs


double RiskPercent = 0.35;//35/2.0
//double Lots = 1;

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  { 
	string TicketComment2X  = StringConcatenate(TicketComment2X, Period(),"-","2X");
   string TicketCommentManageOne  = StringConcatenate(TicketCommentManageOne, Period(),"-","MANAGEONE");
   string TicketCommentManageTwo = StringConcatenate(TicketCommentManageTwo, Period(),"-","MANAGETWO");


   int SpreadPointss = MarketInfo(Symbol(),MODE_SPREAD); 
   double SpreadPoints = (SpreadPointss*Point);
   double OnePoint = (1*Point);
   double Risk = RiskPercent / 100;
   double MyStopLoss = ( (High[1]+(SpreadPoints + OnePoint)) - (Low[1]-(((SpreadPoints+SpreadPoints/2))- OnePoint) ) ) / Point; 
   double GetTarget = ( (High[1]+(SpreadPoints + OnePoint)) - (Low[1]- (((SpreadPoints + SpreadPoints/2))- OnePoint) ) ) ; 

//   double MyStopLoss = ( (High[1]+(SpreadPoints + OnePoint)) - (Low[1]-((SpreadPoints/2)- OnePoint) ) ) / Point; 
//   double GetTarget = ( (High[1]+(SpreadPoints + OnePoint)) - (Low[1]- ((SpreadPoints/2)- OnePoint) ) ) ; 




// double GetTarget = ( (High[1]+(SpreadPoints + OnePoint)) - (Low[1]- OnePoint) ) ;  
   double TargetShort = NormalizeDouble((Low[1]-GetTarget),Digits);//testing Digits 
   double Lots = NormalizeDouble( AccountBalance()*Risk/MyStopLoss/(MarketInfo(Symbol(), MODE_TICKVALUE)),2); 
   double LotsDivided = (Lots/2);
   double GetBid =  MarketInfo(Symbol(),MODE_BID);
   double Allowable = (OnePoint*5);
   double AutoAllowable = (OnePoint*MarketInfo(Symbol(),MODE_STOPLEVEL));
   double EntryPrice;
   double BIDANDPOINTS = (GetBid - OnePoint); 
   double LOWANDPOINTS = (Low[1]- OnePoint);


if   (BIDANDPOINTS < LOWANDPOINTS+AutoAllowable) 
  { 
    EntryPrice = BIDANDPOINTS-AutoAllowable;  
  } else 
  { 
    EntryPrice = LOWANDPOINTS;  
  } 
  








  if(Lots > 0)
   OrderSend(Symbol(),OP_SELLSTOP, Lots, EntryPrice,3,(High[1]+(SpreadPoints+(SpreadPoints/2)+OnePoint)) , TargetShort, TicketComment2X, 0, NULL, LimeGreen);
   OrderSend(Symbol(),OP_SELLSTOP, LotsDivided, EntryPrice,3,(High[1]+(SpreadPoints+(SpreadPoints/2)+OnePoint)) , 0, TicketCommentManageOne, 0, NULL, LimeGreen);
   OrderSend(Symbol(),OP_SELLSTOP, LotsDivided, EntryPrice,3,(High[1]+(SpreadPoints+(SpreadPoints/2)+OnePoint)) , 0, TicketCommentManageTwo, 0, NULL, LimeGreen);




           
   return(0);
  }
//+------------------------------------------------------------------+