Orders Execution
0
Views
0
Downloads
0
Favorites
Profitability Reports
AUD/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%
RSIOMAEA
//+------------------------------------------------------------------+
//| RSIOMAEA.mq4 |
//| @2009 Desynced Tech |
//| http://desynced.no-ip.org/fx |
//+------------------------------------------------------------------+
#property copyright "@2009 Desynced Tech"
#property link "http://desynced.no-ip.org/fx"
//#include <mysql.mqh>
extern int MAGIC = 45;
extern int takeprofit = 284;
extern int stoploss = 60 ;
extern double lots =0.1;
extern int minHoursBetweenTrades = 4;
double tp;
double sl;
int ticket;
datetime lastOrder;
int tick =0;
int maxTicks = 10;
int init()
{
//----
//----
return(0);
}
int deinit()
{
//----
//----
return(0);
}
datetime PreviousBar;
bool NewBar()
{
if(PreviousBar<Time[0])
{
PreviousBar = Time[0];
return(true);
}
else
{
return(false);
}
return(false);
}
bool canTrade() {
//the conditions are for a GMT+0 time , please adjust to your timeframe
if ( Hour() >= 1 && Hour() < 2 ) return (false);
if ( Hour() >= 9 && Hour() < 10 ) return (false);
if ( Hour() >= 13 && Hour() < 14 ) return (false);
if ( Hour() == 17 ) return(false);
return (true);
}
void checkTicket (int tik) {
int hstTotal=OrdersHistoryTotal();
if(OrderSelect(tik,SELECT_BY_TICKET,MODE_HISTORY) !=false ) {
lastOrder = OrderCloseTime();
ticket =0;
}
}
int start()
{
int tik = getNumberTrades();
if ( tik != -1 ) {
//if ( OrderProfit() > maxprofit ) maxprofit = OrderProfit();
/*
if ( OrderType() == OP_BUY && OrderProfit() > 0 ) {
// Print(" diff " ,OrderProfit() , " = > " ,((OrderTakeProfit() - Ask)/Point));
if ( ((OrderTakeProfit() - Ask)/Point) <= 10 ) OrderModify(tik,OrderOpenPrice(),Bid-takeprofit*Point,Ask+50*Point,0,Blue);
}
if ( OrderType() == OP_SELL && OrderProfit() > 0 ) {
if ( ( (OrderTakeProfit()-Bid)/Point)*(-1) <= 10) OrderModify(tik,OrderOpenPrice(), Ask+takeprofit*Point,Bid-50*Point,0,Red);
// Print(" diff sell " ,OrderProfit() , " = > " ,( (OrderTakeProfit()-Bid)/Point)*(-1));
}
*/
}
else {
if ( ticket != 0 ) checkTicket(ticket);
}
if ( !canTrade() ) {
return(0);
}
if(NewBar() == false ) return(0);
int trend = 0;
double x0 = iCustom(NULL, 0, "rsioma_v4",0,0);
double y0 = iCustom(NULL, 0, "rsioma_v4",5,0);
double x1 = iCustom(NULL, 0, "rsioma_v4",0,1);
double y1 = iCustom(NULL, 0, "rsioma_v4",5,1);
if ( x1 > y1 && y0 > x0 ) trend = -1;
if ( y1 > x1 && x0 > y0 ) trend = 1 ;
if ( trend == 1 && tik == -1 && x0 < 30 && y0 < 30 && x0 > 10 && (TimeCurrent() - lastOrder) > (60*60*minHoursBetweenTrades) ) {
/*
if ( takeprofit > 0 ) tp = Ask+takeprofit*Point;
else tp = 0;
if ( stoploss > 0 ) sl = Ask-stoploss*Point;
ticket = OrderSend(Symbol(),OP_BUY, lots, Ask, 3, sl, tp,"", MAGIC, 0, Red);
*/
if ( takeprofit > 0 ) {
tp = Bid-takeprofit*Point;
}
else tp = 0;
if ( stoploss > 0 ) sl = Bid+stoploss*Point;
else sl = 0;
ticket = OrderSend(Symbol(),OP_SELL, lots, Bid, 3, sl, tp,"", MAGIC, 0, Red);
ObjectCreate("sell!!!!!!!!!!!!", OBJ_TEXT, 0, Time[0], Bid);
if ( ticket > 0 ) {
/*
mysql_connect("192.168.0.3","forex","forex","forex",3306);
insertOrderDb(ticket,Symbol(),Bid,0, tp,MAGIC,"RSIOMAEA",OP_BUY, TimeCurrent());
mysql_close(mysql);
*/
lastOrder = TimeCurrent();
return(0);
}
}
if ( trend == -1 && tik == -1 && x0 > 70 && y0 > 70 && (TimeCurrent() - lastOrder) > (60*60*minHoursBetweenTrades)) {
/*
if ( takeprofit > 0 ) {
tp = Bid-takeprofit*Point;
}
else tp = 0;
if ( stoploss > 0 ) sl = Bid+stoploss*Point;
else sl = 0;
ticket = OrderSend(Symbol(),OP_SELL, lots, Bid, 3, sl, tp,"", MAGIC, 0, Red);
*/
if ( takeprofit > 0 ) tp = Ask+takeprofit*Point;
else tp = 0;
if ( stoploss > 0 ) sl = Ask-stoploss*Point;
ticket = OrderSend(Symbol(),OP_BUY, lots, Ask, 3, sl, tp,"", MAGIC, 0, Red);
ObjectCreate("buy!!!!!!!!!!!!", OBJ_TEXT, 0, Time[0], Ask);
if ( ticket > 0 ) {
/*
mysql_connect("192.168.0.3","forex","forex","forex",3306);
insertOrderDb(ticket,Symbol(),Bid,0, tp,MAGIC,"RSIOMAEA",OP_SELL, TimeCurrent());
mysql_close(mysql);
*/
lastOrder = TimeCurrent();
return(0);
}
}
//----
//----
return(0);
}
int getNumberTrades()
{
int total = OrdersTotal();
int numords = 0;
for(int cnt=0; cnt<total; cnt++)
{
OrderSelect(cnt, SELECT_BY_POS);
if(OrderSymbol() == Symbol() && OrderMagicNumber() == MAGIC)
return (OrderTicket());
}
return(-1);
}
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---