Author: Copyright � 2008, smjones
Orders Execution
It automatically opens orders when conditions are reached
0 Views
0 Downloads
0 Favorites

Profitability Reports

GBP/USD Oct 2024 - Jan 2025
0.00 %
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
NZD/USD Oct 2024 - Jan 2025
0.00 %
Total Trades 0
Won Trades 0
Lost trades 0
Win Rate 0.0 %
Expected payoff 0.00
Gross Profit 0.00
Gross Loss 0.00
Total Net Profit 0.00
-100%
-50%
0%
50%
100%
autobuy
//+------------------------------------------------------------------+
//|                                              Buy  with SL and TP |
//|                               Copyright © 2008, smjones          |
//|                                               sjcoinc            |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, smjones"
#property link      "sjcoinc2000@yahoo.com"


#property show_inputs

extern double Lots = 1;
extern double Entry = 0.0000;
extern double TakeProfit = 0;
extern double StopLoss = 9999;
extern bool   UseActualSlTp = false;
extern double StopLossPrice = 0.0000;
extern double TakeProfitPrice = 0.0000;
extern int    NumberOfOrders = 1;
extern bool   MicroOrdersAllowed = true;
extern bool   MiniOrdersAllowed = true;
extern bool   UseMoneyMgmt = false;
extern double RiskPercent = 1;
extern string Note="0 in Entry field means Market Order Buy";
extern string Comments = "Buy Script";



//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  { 
  double Risk = RiskPercent / 100;
  int OrdersizeAllowed = 0;
  int Mode = OP_BUYSTOP;
  if (Ask > Entry && Entry > 0) Mode = OP_BUYLIMIT; 
  if (Entry == 0)  {Entry = Ask; Mode = OP_BUY;}
  double SLB = Entry - StopLoss*Point, TPB = Entry + TakeProfit*Point;

  if (UseActualSlTp)
      {
         StopLoss = (Entry-StopLossPrice)/Point;
         SLB = StopLossPrice;
         TPB = TakeProfitPrice;    
      }
  if (MiniOrdersAllowed) OrdersizeAllowed=1;
  if (MicroOrdersAllowed) OrdersizeAllowed=2;        
  if (UseMoneyMgmt)  
      Lots = NormalizeDouble( AccountBalance()*Risk/StopLoss/(MarketInfo(Symbol(), MODE_TICKVALUE)),OrdersizeAllowed);       

  if ((Lots < 0.01&&MicroOrdersAllowed) || (Lots < 0.1&&MiniOrdersAllowed&&MicroOrdersAllowed==false))
      {
         Comment("YOUR LOTS SIZE IS TOO SMALL TO PLACE!");
      } 

  if(Lots > 0)
  for (int i=0;i<NumberOfOrders;i++)
      {
         OrderSend(Symbol(),Mode, Lots, Entry, 2,SLB , TPB, Comments, 0, NULL, LimeGreen);
      }

           
   return(0);
  }
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---