Disliked{quote} Auguri anche a te Fammi vedere dopo la tua versione ottimizzata.. LukeIgnored
I was able only once to view the optimization data and then choose which could be the best possible settings. Now I can't see anything anymore ...
Here's what I see and what result I get at the end of the optimization.
However, I noted with pleasure that you are an expert in MQL4, if you have instructions or manuals where I can study the MQL4 language I would be happy, otherwise if you do learning courses for MQL4 I am very interested.
The MQL4 language fascinates me a lot and I'm doing everything self-taught.
I await yours.
Thank you very much and good day!
I'm trying to get to this project:
1-Record Maxima and Minima from 11.00pm to 8.00am
(Variable Time modifiable in extern)
2-Enter long market at the break of the maximum recorded if:
- there are no other open positions
- the time is less than 14
(Maximum time that you can enter the market can be changed extern).
-Take profit = pips obtained from the difference between the maximum value and the minimum recorded value added to the maximum value
-Stoploss = value of the minimum - value of the ATR7
(Set up location lots in extern)
(Set the ATR value extern)
3-Enter the market short at the break of the minimum recorded if:
- there are no other open positions
- the time is less than 14
(Maximum time that you can enter the market can be changed extern)
(Set up location lots in extern)
(Set the ATR value extern)
-Take profit = pips obtained from the difference between the maximum value and the minimum value recorded, subtracted from the minimum value
-Stop Loss = value of the maximum plus value of the ATR7
(Set the ATR value extern)
4-Overnight close all positions at 11pm
(set yes or no from extern)
the modified code is:
//+------------------------------------------------------------------+
//| Ea Canale Notturno.mq4 |
//| Rosario Greco |
//| https://it.tradingview.com/u/FibotradingFx/ |
//+------------------------------------------------------------------+
#property copyright "Rosario Greco"
#property link "https://it.tradingview.com/u/FibotradingFx/"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
double MassimoCanale;
double MinimoCanale;
extern double LOTTI=0.01;
int TicketBuy;
int TicketSell;
extern int SL=30;
extern int TP=30;
bool ContatoreCanale=true;
bool ContatoreOrdineLong=true;
bool ContatoreOrdineShort=true;
int OnInit()
{
//---
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
if(Hour()==8) ContatoreOrdineLong=true;
if(Hour()==8) ContatoreOrdineShort=true;
MemorizzaCanale();
if(Ask>MassimoCanale && Hour()<12) EseguiOrdineLong();
if(Bid<MinimoCanale && Hour()<12) EseguiOrdineShort();
NoOverNight();
}
//+------------------------------------------------------------------+
void MemorizzaCanale(){
if(Hour()==9 && Minute()<=5 && ContatoreCanale){
MassimoCanale=iHigh(Symbol(),PERIOD_CURRENT,iHighest(Symbol(),PERIOD_CURRENT,MODE_HIGH,10,1));
MinimoCanale=iLow(Symbol(),PERIOD_CURRENT,iLowest(Symbol(),PERIOD_CURRENT,MODE_LOW,10,1));
ContatoreCanale=false;
}
if(Hour()==8 && !ContatoreCanale) ContatoreCanale=true;
}
void EseguiOrdineLong(){
if(Hour()>=9 && ContatoreOrdineLong){
TicketBuy=OrderSend(Symbol(),OP_BUY,LOTTI,Ask,0,Ask-SL*10*Point,Ask+TP*10*Point,"ordine buy strategia canale notturno",0,0,0);
if(TicketBuy<0){
Print("Errore Ordine Buy: ",GetLastError());
}
else ContatoreOrdineLong=false;
}
}
void EseguiOrdineShort(){
if(Hour()>=9 && ContatoreOrdineShort){
TicketSell=OrderSend(Symbol(),OP_SELL,LOTTI,Bid,0,Bid+SL*10*Point,Bid-TP*10*Point,"ordine sell strategia canale notturno",0,0,0);
if(TicketSell<0){
Print("Errore Ordine Sell: ",GetLastError());
}
else ContatoreOrdineShort=false;
}
}
void NoOverNight(){
if(OrdersTotal()>0 && Hour()==23){
if(!OrderSelect(TicketBuy,SELECT_BY_TICKET,MODE_TRADES)){
Print("Errore ordine select: ", GetLastError());
}
if(OrderCloseTime()==0){
if(!OrderClose(OrderTicket(),OrderLots(),Bid,0,0)){
Print("Errore ordine close: ", GetLastError());
}
}
if(!OrderSelect(TicketSell,SELECT_BY_TICKET,MODE_TRADES)){
Print("Errore ordine select: ", GetLastError());
}
if(OrderCloseTime()==0){
if(!OrderClose(OrderTicket(),OrderLots(),Ask,0,0)){
Print("Errore ordine close: ", GetLastError());
}
}
}
}
Attached File(s)
Ea Canale Notturno.mq4
3 KB
|
236 downloads