0
Views
0
Downloads
0
Favorites
SuperPosition
//+------------------------------------------------------------------+
//| SuperPosition.mq4 |
//| @2009 Desynced Tech |
//| http://desynced.no-ip.org/fx |
//+------------------------------------------------------------------+
#property copyright "@2009 Desynced Tech"
#property link "http://desynced.no-ip.org/fx"
extern int MAGIC = 31;
extern double lots = 0.1;
extern int minHoursBetweenTrades = 0;
#include <commonEA.mqh>
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
int decision() {
//azul = slow = 4
//vermelho = fast = 3
double fast0 = iCustom(NULL, 0, "rsi_demarker_super_position",3,0);
double fast1 = iCustom(NULL, 0, "rsi_demarker_super_position",3,1);
double slow0 = iCustom(NULL, 0, "rsi_demarker_super_position",4,0);
double slow1 = iCustom(NULL, 0, "rsi_demarker_super_position",4,1);
double dem0 = iCustom(NULL, 0, "rsi_demarker_super_position",1,0);
double dem1 = iCustom(NULL, 0, "rsi_demarker_super_position",1,1);
double div0 = iCustom(NULL, 0, "rsi_demarker_super_position",5,0);
// Print(fast0 , " ", fast1 , " " , slow0 , " " , slow1 ) ;
if ( slow1 < fast1 && slow0 > fast0 && (TimeCurrent() - lastOrder) > (60*60*minHoursBetweenTrades) && div0 < 0 /*&& dem1 > fast1 && dem1 > slow1 && dem0 < fast0 && dem0 < slow0 */) {
if ( div0 > 0.2 ) Print(fast0 , " ", fast1 , " " , slow0 , " " , slow1, " div " , div0 ) ;
return(1);
}
if ( fast1 < slow1 && fast0 > slow0 && div0 > 0 && (TimeCurrent() - lastOrder) > (60*60*minHoursBetweenTrades)) return(-1);
return (0);
}
int start()
{
getTrades(MAGIC);
if ( orderTik != -1 ) {
calculateProfit(orderTik,6);
return(0);
}
else {
lastOrder= checkTicket(orderTik);
}
if ( !canTrade() ) return(0);
if(NewBar() == false ) return(0);
int decision = decision();
if ( decision == -1 ) {
//int openOrder(int orderType, double lots , int takeProfit , int stopLoss,int MAGIC )
orderTik= openOrder(OP_SELL, lots , 100 , 200 , MAGIC );// OrderSend(Symbol(),OP_SELL, lots, Bid, 3, 0, Bid-60*Point,"", MAGIC, 0, Red);
if ( orderTik > 0 ) {
/*
mysql_connect("192.168.0.3","forex","forex","forex",3306);
insertOrderDb(ticket,Symbol(),Bid,0, Bid-60*Point,MAGIC,"woodyEA",OP_SELL, TimeCurrent());
mysql_close(mysql);
*/
// lastOrder = TimeCurrent();
}
}
else if ( decision == 1 ) {
orderTik= openOrder(OP_BUY, lots , 100 , 200 , MAGIC );// OrderSend(Symbol(),OP_SELL, lots, Bid, 3, 0, Bid-60*Point,"", MAGIC, 0, Red);
}
return(0);
}
//+------------------------------------------------------------------+
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
---