trend_manager2

Author: Copyright � 2006, www.easyforexsignals.com
Orders Execution
Checks for the total of open ordersIt can change open orders parameters, due to possible stepping strategyIt automatically opens orders when conditions are reachedIt Closes Orders by itself
0 Views
0 Downloads
0 Favorites

Profitability Reports

AUD/USD Oct 2024 - Jan 2025
55.00 %
Total Trades 200
Won Trades 0
Lost trades 0
Win Rate 0.00 %
Expected payoff -1.47
Gross Profit 361.50
Gross Loss -655.70
Total Net Profit -294.20
-100%
-50%
0%
50%
100%
GBP/USD Oct 2024 - Jan 2025
37.00 %
Total Trades 178
Won Trades 43
Lost trades 135
Win Rate 0.24 %
Expected payoff -2.32
Gross Profit 246.40
Gross Loss -659.90
Total Net Profit -413.50
-100%
-50%
0%
50%
100%
trend_manager2
#property copyright "Copyright © 2006, www.easyforexsignals.com"
#property link "paul@easyforexsignals.com"

#define LONGCOLOR DodgerBlue
#define SHORTCOLOR OrangeRed

#define MAGICTM 20070610

extern double TMlots=0.1;

extern int MoveStopAmount = 20;
extern int MoveStopAfterProfitof = 55;

extern int minadxlevel = 20;
extern double minSolarWind = 0.25;
extern double minJuice = 0.001;

extern int StopLoss=50,
Slippage = 3,
TakeProfit=120;

datetime LastTMSignalTime;
extern int MinTimeBetweenSignals = 60;

int init(){
return(0);
}
int deinit(){
return(0);
}

int start()
{
int res= 0;
if(Bars<100 || IsTradeAllowed()==false) return;

CheckTrendManager(); // check trend manager system
CheckForTMClose(); // check for closes on this system
CheckForStopMove(); // move stops on any open trades
}



void CheckForStopMove() {
for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false)
break;
if(OrderMagicNumber()!=MAGICTM || OrderSymbol()!=Symbol())
continue;

if(OrderType()==OP_BUY)
{
// move up stops to lock in profit
if ((OrderOpenPrice()-Ask) >= (MoveStopAfterProfitof * Point)) {
OrderModify(OrderTicket(),0,OrderOpenPrice()+
(MoveStopAmount*Point),OrderTakeProfit(),0,Black);
}
}
if(OrderType()==OP_SELL)
{
// move up stops to lock in profit
if ((OrderOpenPrice() - Bid) >= (MoveStopAfterProfitof * Point)) {
OrderModify(OrderTicket(),0,OrderOpenPrice()-
(MoveStopAmount*Point),OrderTakeProfit(),0,Black);
}
}
}
}

void CheckTrendManager() {
if (Time[0]-LastTMSignalTime > MinTimeBetweenSignals) {
double PipsStopLoss, PipsTakeProfit;
double TMbuy = iCustom(Symbol(),Period(), "TrendManagerNT",2, 0);
double TMsell = iCustom(Symbol(),Period(), "TrendManagerNT",3, 0);
int orderresult;

if (TMbuy > 0) {
if (CheckFilters(OP_BUY)==true)
{
PipsStopLoss = Ask-(StopLoss * Point);
PipsTakeProfit = Ask+(TakeProfit * Point);
CloseExisting(OP_SELL);
orderresult =OrderSend(Symbol
(),OP_BUY,TMlots,Ask,Slippage,PipsStopLoss,
PipsTakeProfit,"",MAGICTM,0,Maroon);
Print(Time[0] + "BUY ON TM,order result was :" +
orderresult + "stop:" + PipsStopLoss + ",takeprofit:" +
PipsTakeProfit);
LastTMSignalTime = Time[0];
}
}

if (TMsell > 0){
if (CheckFilters(OP_SELL)==true) {

PipsStopLoss = Bid+(StopLoss * Point);
PipsTakeProfit = Bid-(TakeProfit * Point);

CloseExisting(OP_BUY);
orderresult = OrderSend(Symbol
(),OP_SELL,TMlots,Bid,Slippage,PipsStopLoss,PipsTakeProfit,"",MAGICTM,
0,Green);
Print(Time[0] + "SELL ON TM, order result was :" +
orderresult + "stop:" + PipsStopLoss + ",takeprofit:" +
PipsTakeProfit);
LastTMSignalTime = Time[0];
}
}
}
}

void CheckForTMClose() {

double TMclosesell = iCustom(Symbol(),Period(), "TrendManagerNT",4,
0);
double TMclosebuy = iCustom(Symbol(),Period(), "TrendManagerNT",5,
0);

for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false)
break;
if(OrderMagicNumber()!=MAGICTM || OrderSymbol()!=Symbol())
continue;
//---- just close it
if ((TMclosesell > 0) && (OrderType()==OP_SELL)) {
OrderClose(OrderTicket(),OrderLots
(),Bid,10,Pink);
}
if ((TMclosebuy > 0) && (OrderType()==OP_BUY)) {
OrderClose(OrderTicket(),OrderLots
(),Bid,10,Pink);
}
}

}

// just closes any existing positions
void CloseExisting(int OrderTyp)
{

for(int i=0;i<OrdersTotal();i++)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false)
break;
if(OrderMagicNumber()!=MAGICTM || OrderSymbol()!=Symbol())
continue;
//---- just close it std slippage
if(OrderType()==OrderTyp)
{
OrderClose(OrderTicket(),OrderLots
(),Bid,10,White);
}
}
}


bool CheckFilters(int OrderTyp) {
return(true);
}

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 ---