Hello to you, I hope all you are well and I hope that someone can help me here, the meaning of the trades is bullish so we find ourselves in a bullish scenario, here is my strategy:
1- We have a Haussier crossing of stochastic in H1
2- We descend from 2 timeframe to go to M15 and we will spill the previous Pic du Sochastic M15 above the 50 before the stochastic crossing cited above
3-Enuite we are tracing a right relating to this peak in terms of price and take a stand at the break of this right
Here is my loss; After having declared my sochastic variables in H1, I would in fact get the index of the candle on which our Stochastic H1 crossroads took place in order to use it in the IHIGHEST function (symbol, timeframe, type, count, start) In terms of start, in order to make this value act up with each new candle. Thank you
- Check stochastic value / position on open of new candle.
- Place order right before candle/bar ends on daily timeframe
- MQL4 Guide
If you need help with your code, then you have to show your code! Otherwise, how are we supposed to guide you?
Add your code with the "</>" icon on the toolbar or Alt-S, or attach the original file directly with the "+ Attach file" button below the text box.
//+------------------------------------------------------------------+ //| LVIK-BASE-EA.mq4 | //| Property: Boursikoter.com | //+----------------------Email: ikiu91@gmail.com---------------------+ #property copyright "Copyright © 2019, Ikiu91" #property link "https://boursikoter.com" #define SIGNAL_NONE 0 #define SIGNAL_BUY 1 #define SIGNAL_SELL 2 #define SIGNAL_CLOSEBUY 3 #define SIGNAL_CLOSESELL 4 extern int MagicNumber = 001;//MagicNumber = Numéro unique parmi les divers algorithmes extern string Strategy = "STRATEGIE DU LUNDI";//Renseigner le nom de la stratégie pour les alertes extern string TimeFilter = "==Time Filter=="; extern int DayOfWeek = 1; extern int HourStartTime = 1;//Heure de Début de la periode de trading extern int MinuteStartTime = 0;//Minute de Début de la periode de trading extern int HourStopTime = 21;//Heure de Fin de la periode de trading extern int MinuteStopTime = 0;//Minute de Fin de la periode de trading extern int HourCloseTime = 23;//Heure de Cloture de toutes les positions extern int MinuteCloseTime = 50;//Minute de Cloture de toutes les positions extern string MoneyManagement = "==Money Management=="; extern double Risk = 1.0;//Risque sur le portefeuille en pourcentage extern double Lots = 0;//A renseigner pour utiliser une exposition fixe (annule l'exposition proportionelle) extern int StopLoss = 500;//Ecart du Stop Loss Fixe en PIP(obligatoire pour utiliser l'exposition proportionelle) extern int TrailingStop = 500;//Ecart du Stop Suiveur en PIP extern int TakeProfit = 200;//Ecart du TP Fixe en PIP extern string SendAlert = "==Send Alert=="; extern bool SignalMail = False;//Activer les alertes mail extern bool SignalPush = False;//Activer les alertes push extern bool SignalAlert = False;//Activer les alertes sonores bool EachTickMode = True; int Slippage = 3; int BarCount,Current,EntryBar; double Balance,StopLossLevel,TakeProfitLevel,TrailingStopLevel,DecLot,Expo; string Trend; bool TickCheck = False; bool EAActivated = False; int JourneedeLundi; bool VENTE = False; bool ACHAT = False; //Définition d'un indicateur personnalisé pour optimisation' //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double OnTester() { return (TesterStatistics(STAT_EQUITYDD_PERCENT) ? TesterStatistics(STAT_PROFIT)/NormalizeDouble(TesterStatistics(STAT_EQUITYDD_PERCENT),2) : 0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double MinLot = MarketInfo(Symbol(),MODE_MINLOT); double TickValue = MarketInfo(Symbol(),MODE_TICKVALUE); double TickSize = MarketInfo(Symbol(),MODE_TICKSIZE); //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int OnInit() { BarCount = Time[0]; if(MinLot == 1) DecLot = 0; if(MinLot == 0.1) DecLot = 1; if(MinLot == 0.01) DecLot = 2; return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) {} /* int deinit() { return(0); }*/ //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ void OnTick() { int Order = SIGNAL_NONE; int Total, Ticket; if(EachTickMode && Time[0] != BarCount) TickCheck = False; Total = OrdersTotal(); Order = SIGNAL_NONE; //+------------------------------------------------------------------+ //| Filtre Horaire | //+------------------------------------------------------------------+ if((HourStartTime < HourStopTime)) { if(((TimeHour(TimeCurrent()) == HourStartTime && MinuteStartTime >= TimeMinute(TimeCurrent())) || (TimeHour(TimeCurrent()) > HourStartTime)) && ((TimeHour(TimeCurrent()) < HourStopTime) || (TimeHour(TimeCurrent()) == HourStopTime && TimeMinute(TimeCurrent()) < MinuteStopTime))) EAActivated = true; else EAActivated = false; } else { if(((TimeHour(TimeCurrent()) == HourStartTime && MinuteStartTime >= TimeMinute(TimeCurrent())) || (TimeHour(TimeCurrent()) > HourStartTime)) || ((TimeHour(TimeCurrent()) < HourStopTime) || (TimeHour(TimeCurrent()) == HourStopTime && TimeMinute(TimeCurrent()) < MinuteStopTime))) EAActivated = true; else EAActivated = false; } //+------------------------------------------------------------------+ //| Filtre Journalier | //+------------------------------------------------------------------+ if(DayOfWeek() == 1) JourneedeLundi = true; else JourneedeLundi = false; //+------------------------------------------------------------------+ //| Filtre Horaire | //+------------------------------------------------------------------+ double StochastiMain_1 = iStochastic(NULL,PERIOD_H1,5,3,3,MODE_SMA,0,MODE_MAIN,1); double StochastiSignal_1 = iStochastic(NULL,PERIOD_H1,5,3,3,MODE_SMA,0,MODE_SIGNAL,1); double StochastiMain_2 = iStochastic(NULL,PERIOD_H1,5,3,3,MODE_SMA,0,MODE_MAIN,2); double StochastiSignal_2 = iStochastic(NULL,PERIOD_H1,5,3,3,MODE_SMA,0,MODE_SIGNAL,2); double StochastiMain_3 = iStochastic(NULL,PERIOD_H1,5,3,3,MODE_SMA,0,MODE_MAIN,3); double StochastiSignal_3 = iStochastic(NULL,PERIOD_H1,5,3,3,MODE_SMA,0,MODE_SIGNAL,3); double StochastiMain_4 = iStochastic(NULL,PERIOD_H1,5,3,3,MODE_SMA,0,MODE_MAIN,4); double StochastiSignal_4 = iStochastic(NULL,PERIOD_H1,5,3,3,MODE_SMA,0,MODE_SIGNAL,4); double CCI_1 = iCCI(NULL,PERIOD_H1,14,PRICE_TYPICAL,1); double BB_MIDDLE_1 = iBands(NULL,PERIOD_H1,20,2,0,PRICE_CLOSE,MODE_MAIN,1); double CloturePrecedent_1 = iClose(NULL,PERIOD_H1,1); double CCI_2 = iCCI(NULL,PERIOD_H1,14,PRICE_TYPICAL,2); double BB_MIDDLE_2 = iBands(NULL,PERIOD_H1,20,2,0,PRICE_CLOSE,MODE_MAIN,2); double CloturePrecedent_2 = iClose(NULL,PERIOD_H1,2); double CCI_3 = iCCI(NULL,PERIOD_H1,14,PRICE_TYPICAL,3); double BB_MIDDLE_3 = iBands(NULL,PERIOD_H1,20,2,0,PRICE_CLOSE,MODE_MAIN,3); double CloturePrecedent_3 = iClose(NULL,PERIOD_H1,3); double CCI_4 = iCCI(NULL,PERIOD_H1,14,PRICE_TYPICAL,4); double BB_MIDDLE_4 = iBands(NULL,PERIOD_H1,20,2,0,PRICE_CLOSE,MODE_MAIN,4); double CloturePrecedent_4 = iClose(NULL,PERIOD_H1,4); bool condition_1 = StochastiSignal_2 > StochastiMain_2 && StochastiSignal_1 < StochastiMain_1 && CCI_1 < 0 && CloturePrecedent_1 < BB_MIDDLE_1; bool condition_2 = StochastiSignal_3 > StochastiMain_3 && StochastiSignal_2 < StochastiMain_2 && CCI_2 < 0 && CloturePrecedent_2 < BB_MIDDLE_2; bool condition_3 = StochastiSignal_4 > StochastiMain_4 && StochastiSignal_3 < StochastiMain_3 && CCI_3 < 0 && CloturePrecedent_3 < BB_MIDDLE_3; bool condition_4 = StochastiSignal_5 > StochastiMain_5 && StochastiSignal_4 < StochastiMain_4 && CCI_4 < 0 && CloturePrecedent_4 < BB_MIDDLE_4; bool condition_11 = StochastiSignal_2 < StochastiMain_2 && StochastiSignal_1 > StochastiMain_1 && CCI_1 > 0 && CloturePrecedent_1 > BB_MIDDLE_1; bool condition_12 = StochastiSignal_3 < StochastiMain_3 && StochastiSignal_2 > StochastiMain_2 && CCI_2 > 0 && CloturePrecedent_2 > BB_MIDDLE_2; bool condition_13 = StochastiSignal_4 < StochastiMain_4 && StochastiSignal_3 > StochastiMain_3 && CCI_3 > 0 && CloturePrecedent_3 > BB_MIDDLE_3; bool condition_14 = StochastiSignal_5 < StochastiMain_5 && StochastiSignal_4 > StochastiMain_4 && CCI_4 > 0 && CloturePrecedent_4 > BB_MIDDLE_4; if(condition_1 || condition_2 || condition_3 || condition_4 || condition_5 || condition_6 ) ACHAT = true; else ACHAT = false; if(condition_11 || condition_12 || condition_13 || condition_14 || condition_15 || condition_16 ) VENTE = true; else VENTE = false; //+------------------------------------------------------------------+ //| Variable Begin | //+------------------------------------------------------------------+ BarCount = Time[0]; //+------------------------------------------------------------------+ //| Variable End | //+------------------------------------------------------------------+ //Check position bool IsTrade = False; //Boucle de détection de positions en cours for(int i = 0; i < Total; i ++) { bool Select_1 = OrderSelect(i, SELECT_BY_POS, MODE_TRADES); if(OrderType() <= OP_SELL && OrderMagicNumber() == MagicNumber) { IsTrade = True; //+------------------------------------------------------------------+ //| I - SORTIES DE TRADES | //+------------------------------------------------------------------+ if(OrderType() == OP_BUY) { //+------------------------------------------------------------------+ //| CONDITIONS DE SORTIE D'ACHAT ( BUY ) | //+------------------------------------------------------------------+ bool Exit_Buy_Cond1; //Condition 1 de sortie d'achat' bool Exit_Buy_Cond2; //Condition 2 de sortie d'achat' bool Exit_Buy = (Exit_Buy_Cond1 && Exit_Buy_Cond2);//Equation de l'ensemble des conditions qui definissent l'ordre de sortie d'achat non visible' double CustomSLBuyLevel = NormalizeDouble(/*condition à définir*/0,Digits);//Définir le Stop loss personnalisé double CustomTPBuyLevel = NormalizeDouble(/*condition à définir*/0,Digits);//Définir le Take Profit personnalisé if(Exit_Buy) Order = SIGNAL_CLOSEBUY; //Stop Loss Fixe visible if(OrderStopLoss() == 0 && StopLoss != 0) { StopLossLevel = OrderOpenPrice() - (StopLoss * Point); if(Bid <= StopLossLevel) Order = SIGNAL_CLOSEBUY; bool StopBuy = OrderModify(OrderTicket(),OrderOpenPrice(),StopLossLevel,OrderTakeProfit(),0,clrBlue); } //Take Profit Fixe visible if(OrderTakeProfit() == 0 && TakeProfit != 0) { TakeProfitLevel = OrderOpenPrice() + (TakeProfit * Point); if(Bid >= TakeProfitLevel) Order = SIGNAL_CLOSEBUY; bool TPBuy = OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),TakeProfitLevel,0,clrBlue); } //Stop Suiveur visible if(TrailingStop != 0) { TrailingStopLevel = Bid - (TrailingStop * Point); if(Bid <= TrailingStopLevel) Order = SIGNAL_CLOSEBUY; if(TrailingStopLevel > OrderStopLoss()) { bool TSBuy = OrderModify(OrderTicket(),OrderOpenPrice(),TrailingStopLevel,OrderTakeProfit(),0,clrGreen); } } //Stop Personnalisé visible if(CustomSLBuyLevel != 0) { if(Bid <= CustomSLBuyLevel) Order = SIGNAL_CLOSEBUY; if(CustomSLBuyLevel != OrderStopLoss()) { bool CSLBuy = OrderModify(OrderTicket(),OrderOpenPrice(),CustomSLBuyLevel,OrderTakeProfit(),0,clrRed); } } //TP Personnalisé visible if(CustomTPBuyLevel != 0) { if(Bid >= CustomTPBuyLevel) Order = SIGNAL_CLOSEBUY; if(CustomTPBuyLevel != OrderTakeProfit()) { bool CTPBuy = OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),CustomTPBuyLevel,0,clrBlue); } } //+------------------------------------------------------------------+ //| ORDRE DE SORTIE D'ACHAT ( ACHAT ) | //+------------------------------------------------------------------+ if(Order == SIGNAL_CLOSEBUY) { bool Close_Buy = OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen); if(!EachTickMode) BarCount = Time[0]; } } if(OrderType() == OP_SELL) { //Close //+------------------------------------------------------------------+ //| CONDITIONS DE SORTIE DE VENTE ( SELL ) | //+------------------------------------------------------------------+ bool Exit_Sell_Cond1;//Condition 1 de sortie de vente bool Exit_Sell_Cond2;//Condition 2 de sortie de vente bool Exit_Sell = (Exit_Sell_Cond1 && Exit_Sell_Cond2);//Equation de l'ensemble des conditions qui definissent l'ordre de sortie de vente non visible' if(Exit_Sell) Order = SIGNAL_CLOSESELL; double CustomSLSellLevel = NormalizeDouble(/*condition à définir*/0,Digits);//Définir le Stop loss personnalisé double CustomTPSellLevel = NormalizeDouble(/*condition à définir*/0,Digits);//Définir le Take Profit personnalisé //Stop Loss Fixe visible if(OrderStopLoss() == 0 && StopLoss != 0) { StopLossLevel = OrderOpenPrice() + (StopLoss * Point); if(Ask >= StopLossLevel) Order = SIGNAL_CLOSESELL; bool StopSell = OrderModify(OrderTicket(),OrderOpenPrice(),StopLossLevel,OrderTakeProfit(),0,clrRed); } //Take Profit Fixe Visible if(OrderTakeProfit() == 0 && TakeProfit != 0) { TakeProfitLevel = OrderOpenPrice() - (TakeProfit * Point); if(Ask<=TakeProfitLevel) Order = SIGNAL_CLOSESELL; bool TPSell = OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),TakeProfitLevel,0,clrBlue); } //+------------------------------------------------------------------+ //| ORDRE DE SORTIE DE VENTE ( SELL ) | //+------------------------------------------------------------------+ if(Order == SIGNAL_CLOSESELL) { bool Close_Sell = OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, DarkOrange); if(!EachTickMode) BarCount = Time[0]; } } } } //+------------------------------------------------------------------+ //| CONDITIONS DE D'ENTRREE | //+------------------------------------------------------------------+ if(EAActivated == true && JourneedeLundi == true) { if(EachTickMode) { //+-----------------------------Buy----------------------------------+ if(ACHAT == True) { bool Buy_Cond1 = StochastiMain_1 < StochastiSignal_1; // bool Buy_Cond2 = ; // Code to insert ( Condition to insert ) bool Buy_Condition = (Buy_Cond1 && Buy_Cond2);//Equation globale des conditions d'entrée à l'achat' if(Buy_Condition) Order = SIGNAL_BUY ; } //+----------------------------Sell----------------------------------+ if(VENTE == True) { bool Sell_Cond1 = StochastiMain_1 < StochastiSignal_1; // bool Sell_Cond2 = ; // Code to insert ( Condition to insert ) bool Sell_Condition = (Sell_Cond1 && Sell_Cond2);//Equation globale des conditions d'entrée à la vente' if(Sell_Condition) Order = SIGNAL_SELL; } } //+------------------------------------------------------------------+ //| ORDRE DE D'ENTREE | //+------------------------------------------------------------------+ //Passage d'ordre Buy' if(((EachTickMode && !TickCheck) || (!EachTickMode && (Time[0] != BarCount))) && !IsTrade && Order == SIGNAL_BUY) { if(Lots == 0 && StopLoss != 0) { Expo = NormalizeDouble(((AccountBalance() * Risk) / (100 * StopLoss * Point * TickValue / TickSize)),DecLot); } else { Expo = Lots; } Print("Expo = "+Expo); Ticket = OrderSend(Symbol(), OP_BUY, Expo, Ask, Slippage, 0, 0, Strategy+"["+Symbol()+"]" + MagicNumber, MagicNumber, 0, clrBlue); if(Ticket > 0) { if(SignalMail) SendMail("Open Buy "+Symbol(),"Open Buy "+Symbol()+Strategy); if(SignalAlert) Alert("Open Buy "+Symbol()+"Open Buy "+Symbol()+Strategy); if(SignalPush) SendNotification("Open Buy "+Symbol()+"Open Buy "+Symbol()+Strategy); if(OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) { EntryBar = Time[0]; } else { Print("Error opening BUY order : ", GetLastError()); } } if(EachTickMode) TickCheck = True; if(!EachTickMode) BarCount = Time[0]; return; } //Passage d'ordre Sell if(((EachTickMode && !TickCheck) || (!EachTickMode && (Time[0] != BarCount))) && !IsTrade && Order == SIGNAL_SELL) { if(Lots == 0 && StopLoss != 0) { Expo = NormalizeDouble(((AccountBalance() * Risk) / (100 * StopLoss * Point * TickValue / TickSize)),DecLot); } else { Expo = Lots; } Print("Expo = "+Expo); Ticket = OrderSend(Symbol(), OP_SELL, Expo, Bid, Slippage, 0, 0, Strategy+"["+Symbol()+"]" + MagicNumber, MagicNumber, 0,clrRed); if(Ticket > 0) { if(SignalMail) SendMail("Open Sell "+Symbol(),"Open Sell "+Symbol()+Strategy); if(SignalAlert) Alert("Open Sell "+Symbol()+"Open Sell "+Symbol()+Strategy); if(SignalPush) SendNotification("Open Sell "+Symbol()+"Open Sell "+Symbol()+Strategy); if(OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES)) { EntryBar = Time[0]; } else { Print("Error opening SELL order : ", GetLastError()); } } if(EachTickMode) TickCheck = True; if(!EachTickMode) BarCount = Time[0]; return; } } if(!EachTickMode) BarCount = Time[0]; return; } //+------------------------------------------------------------------+
Here is a bit of the strategy in image, I had to reduce the code because of the character limit
Files:
Capture_dykcran_4276.png
400 kb
Capture_dz6cran_u28y.png
461 kb
Voila la partie qui me pose probleme
if(EAActivated == true && JourneedeLundi == true) { if(EachTickMode) { //+-----------------------------Buy----------------------------------+ if(ACHAT == True) { bool Buy_Cond1 = StochastiMain_1 < StochastiSignal_1; // bool Buy_Cond2 = ; // Code to insert ( Condition to insert ) bool Buy_Condition = (Buy_Cond1 && Buy_Cond2);//Equation globale des conditions d'entrée à l'achat' if(Buy_Condition) Order = SIGNAL_BUY ; } //+----------------------------Sell----------------------------------+ if(VENTE == True) { bool Sell_Cond1 = StochastiMain_1 < StochastiSignal_1; // bool Sell_Cond2 = ; // Code to insert ( Condition to insert ) bool Sell_Condition = (Sell_Cond1 && Sell_Cond2);//Equation globale des conditions d'entrée à la vente' if(Sell_Condition) Order = SIGNAL_SELL; } }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register