#include "aCandlePatterns.mqh" in my expert.
Does expert found this file?
Can you attach the files?
Does expert found this file?
Can you attach the files?
hi dear friend.
i attached files and dont know how use a function of a class into an EA.
thank you
Here's your other topic which I have to delete :
hi traders.
i want to make an EA based on candle patterns and i have candle pattern functions in aCandlePatterns.mqh (attached below).
i called it by:
#include "aCandlePatterns.mqh"
and
define a new
CCandlePattern cc;
and i want to use "CheckPatternMorningStar()" function into my EA as follows:
bool Buy_Condition_1=cc.CheckPatternMorningStar();
is my solution correct?
when i want to test it in strategy tester , i have an error.
please guide me .
thanks.
Please don't create multiple topic asking the same question :
Here's your other topic which I have to delete :
hi
ok- thank you for your comment
Well... i had a hard time trying to answer the same question. If i try to do any similar code, i will receive an null pointer error in debug mode. Anyone knows how to solve this?
Thanks in advance!
Well... i had a hard time trying to answer the same question. If i try to do any similar code, i will receive an null pointer error in debug mode. Anyone knows how to solve this?
Thanks in advance!
//+------------------------------------------------------------------+ //| codigo_envio.mq5 | //| Copyright 2014,Leandro C | //| http://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2014,Leandro C" #property link "none" #property version "1.00" //--- includes #include <Trade\Trade.mqh> //#include <reverse_operation.mqh> #include "acandlepatterns.mqh" //#include <Expert\Expert.mqh> //--- input parameters input double Lot=1.0; // Lotes ou contratos input int TakeProfit=500; // Take Profit input int StopLoss=400; // Stop Loss // Snap Code for getting low and max for a specified period. To fix: https://www.mql5.com/en/forum/1422 double High[],Low[]; bool buyS=true; //+------------------------------------------------------------------+ //| Ending the indicators loading | //+------------------------------------------------------------------+ // Defining trade variable, CTrade type and setting initial BuyPosition as true CTrade trade; CCandlePattern test; //CExpert ExtExpert; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { double CurrentPrice = 0; if(!PositionSelect(_Symbol)) { { if (buyS) trade.Buy(Lot); //Buy Position at price, at Time else trade.Sell(Lot); } } else // there is a position { if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY) { CurrentPrice=(SymbolInfoDouble(_Symbol,SYMBOL_BID)-PositionGetDouble(POSITION_PRICE_OPEN)); if(CurrentPrice>=TakeProfit) { trade.PositionClose(_Symbol); } if(CurrentPrice<=-StopLoss) { trade.PositionClose(_Symbol); } else if (test.CheckPatternAllBearish() == true) { trade.PositionClose(_Symbol); } } if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_SELL) { CurrentPrice=(PositionGetDouble(POSITION_PRICE_OPEN)-SymbolInfoDouble(_Symbol,SYMBOL_ASK)); if(CurrentPrice>=TakeProfit) { trade.PositionClose(_Symbol); } if(CurrentPrice<=-StopLoss) { trade.PositionClose(_Symbol); } else if (test.CheckPatternAllBullish() == true) { trade.PositionClose(_Symbol); } } } } //+------------------------------------------------------------------+

- www.mql5.com
Hello leandrocsj,
could you please be more specific about your doubt? What exactly is the problem?
I would advise you to create a new topic for your question, instead of keep posting your problem inside this topic.
Regards,
Malacarne

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi taders
i want to use function CheckCandlestickPattern() of aCandlePatterns.mqh
and i wrote
#include "aCandlePatterns.mqh" in my expert.
how can i use the functions of this class
for example
bool Buy_Condition_1=CheckCandlestickPattern(CANDLE_PATTERN_MORNING_STAR);
is not correct and the error is:
'CheckCandlestickPattern' - function not defined .
shoud i define another class or other else?
thank you alot