Pava:
I have a simple way estimating system...if I take a look @ it and feel even slightly nervous...I forgetaboutit...your picture makes me nervous
Let us make it more comfortable for your ease.
now you can better understand how these filtering out each other,when all two showing any same direction,dont change your mode when any single produce some false/short signal.
Hi mladen, I also tried to make an simple EA from averages - mtf - alerts 8.4.ex4. And I think I understand a bit more now, all parameters from the indicator seem to work in the EA (or the opposite if you like). And now the EA opens order, but something is wrong with how it opens orders. It only opens sell orders, and not when it should.
//------------------------------------------------------------------#property copyright"www.forex-tsd.com"#property link"www.forex-tsd.com"#property strict//------------------------------------------------------------------enum enPrices
{
pr_close, // Close
pr_open, // Open
pr_high, // High
pr_low, // Low
pr_median, // Median
pr_typical, // Typical
pr_weighted, // Weighted
pr_average, // Average (high+low+open+close)/4
pr_medianb, // Average median body (open+close)/2
pr_tbiased, // Trend biased price
pr_haclose, // Heiken ashi close
pr_haopen , // Heiken ashi open
pr_hahigh, // Heiken ashi high
pr_halow, // Heiken ashi low
pr_hamedian, // Heiken ashi median
pr_hatypical, // Heiken ashi typical
pr_haweighted, // Heiken ashi weighted
pr_haaverage, // Heiken ashi average
pr_hamedianb, // Heiken ashi median body
pr_hatbiased // Heiken ashi trend biased price
};
externint MagicNumber = 123456; // Magic number to use for the EAexternbool EcnBroker = false; // Is your broker ECN/STP type of broker?externdouble LotSize = 0.1; // Lot size to use for tradingexternint Slippage = 3; // Slipage to use when opening new ordersexterndouble StopLoss = 100; // Initial stop loss (in pips)externdouble TakeProfit = 100; // Initial take profit (in pips)externstring dummy1 = ""; // .externstring dummy2 = ""; // Settings for indicatorsexternint BarToUse = 1; // Bar to test (0, for still opened, 1 for first closed, and so on)externint CustomTF = 0; // Custom time frame to useexternint AveragePeriod = 14; // Average periodextern enPrices PriceToUse = pr_close; // Price to useexternint AverageMethod = 20; // Average Methodexternbool DoubleSmoothedAverage = false; // Double Smoothed Averageexternbool AdaptiveAverage = false; // Adaptive Averageexterndouble Filter = 0; // Filter (<=0, no filtering)externint Filterapplied = 0; // Filter should be applied toexternstring dummy3 = ""; // . externstring dummy4 = ""; // General settingsexternbool DisplayInfo = true; // Dislay infobool dummyResult;
//------------------------------------------------------------------////------------------------------------------------------------------//////////int init() { return(0); }
int deinit() { return(0); }
//------------------------------------------------------------------////------------------------------------------------------------------//////////#define _doNothing 0#define _doBuy 1#define _doSell 2int start()
{
int doWhat = _doNothing;
double hull_trend_current = iCustom(NULL,0,"averages - mtf - alerts 8.4",PERIOD_CURRENT,CustomTF,AveragePeriod,PriceToUse,AverageMethod,DoubleSmoothedAverage,AdaptiveAverage,Filter,Filterapplied,10,BarToUse);
double hull_trend_previous = iCustom(NULL,0,"averages - mtf - alerts 8.4",PERIOD_CURRENT,CustomTF,AveragePeriod,PriceToUse,AverageMethod,DoubleSmoothedAverage,AdaptiveAverage,Filter,Filterapplied,10,BarToUse+1);
if (hull_trend_current!=hull_trend_previous)
if (hull_trend_current==1)
doWhat = _doBuy;
else doWhat = _doSell;
if (doWhat==_doNothing && !DisplayInfo) return(0);
//////////int openedBuys = 0;
int openedSells = 0;
double currentProfit = 0;
for (int i = OrdersTotal()-1; i>=0; i--)
{
if (!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
if (OrderSymbol() != Symbol()) continue;
if (OrderMagicNumber() != MagicNumber) continue;
//////////if (DisplayInfo) currentProfit += OrderProfit()+OrderCommission()+OrderSwap();
//////////if (OrderType()==OP_BUY)
if (doWhat==_doSell)
{ RefreshRates(); if (!OrderClose(OrderTicket(),OrderLots(),Bid,Slippage,CLR_NONE)) openedBuys++; }
else openedBuys++;
if (OrderType()==OP_SELL)
if (doWhat==_doBuy)
{ RefreshRates(); if (!OrderClose(OrderTicket(),OrderLots(),Ask,Slippage,CLR_NONE)) openedSells++; }
else openedSells++;
}
if (DisplayInfo) Comment("Current profit : "+DoubleToStr(currentProfit,2)+" "+AccountCurrency()); if (doWhat==_doNothing) return(0);
//////////if (doWhat==_doBuy && openedBuys==0)
{
RefreshRates();
double stopLossBuy = 0; if (StopLoss>0) stopLossBuy = Ask-StopLoss*Point*MathPow(10,Digits%2);
double takeProfitBuy = 0; if (TakeProfit>0) takeProfitBuy = Ask+TakeProfit*Point*MathPow(10,Digits%2);
if (EcnBroker)
{
int ticketb = OrderSend(Symbol(),OP_BUY,LotSize,Ask,Slippage,0,0,"",MagicNumber,0,CLR_NONE);
if (ticketb>-1)
dummyResult = OrderModify(ticketb,OrderOpenPrice(),stopLossBuy,takeProfitBuy,0,CLR_NONE);
}
else dummyResult = OrderSend(Symbol(),OP_BUY,LotSize,Ask,Slippage,stopLossBuy,takeProfitBuy,"",MagicNumber,0,CLR_NONE);
}
if (doWhat==_doSell && openedSells==0)
{
RefreshRates();
double stopLossSell = 0; if (StopLoss>0) stopLossSell = Bid+StopLoss*Point*MathPow(10,Digits%2);
double takeProfitSell = 0; if (TakeProfit>0) takeProfitSell = Bid-TakeProfit*Point*MathPow(10,Digits%2);
if (EcnBroker)
{
int tickets = OrderSend(Symbol(),OP_SELL,LotSize,Bid,Slippage,0,0,"",MagicNumber,0,CLR_NONE);
if (tickets>-1)
dummyResult = OrderModify(tickets,OrderOpenPrice(),stopLossSell,takeProfitSell,0,CLR_NONE);
}
else dummyResult = OrderSend(Symbol(),OP_SELL,LotSize,Bid,Slippage,stopLossSell,takeProfitSell,"",MagicNumber,0,CLR_NONE);
}
return(0);
}
What does the number 10 mean in :"double hull_trend_current = iCustom(NULL,0,"averages - mtf - alerts 8.4",PERIOD_CURRENT,CustomTF,AveragePeriod,PriceToUse,AverageMethod,DoubleSmoothedAverage,AdaptiveAverage,Filter,Filterapplied,10,BarToUse);"
before "BarToUse"? If I change it to 9 in simple EA from averages - mtf - alerts 8.4.ex4 it seems to work?
What does the number 10 mean in :"double hull_trend_current = iCustom(NULL,0,"averages - mtf - alerts 8.4",PERIOD_CURRENT,CustomTF,AveragePeriod,PriceToUse,AverageMethod,DoubleSmoothedAverage,AdaptiveAverage,Filter,Filterapplied,10,BarToUse);"
before "BarToUse"? If I change it to 9 in simple EA from averages - mtf - alerts 8.4.ex4 it seems to work?
simon_json:
Thanks! Is it correct to use number 9 in this example? How do I find the right buffer number?
Try using the buffers explorer (the attached) - that way you can see how many buffers are there, what are the values in the buffers and what are their numbers of any indicator using default parameters (just enter the name of the indicator you wish to explore and then chose the buffer numbers)
Try using the buffers explorer (the attached) - that way you can see how many buffers are there, what are the values in the buffers and what are their numbers of any indicator using default parameters (just enter the name of the indicator you wish to explore and then chose the buffer numbers)
Try using the buffers explorer (the attached) - that way you can see how many buffers are there, what are the values in the buffers and what are their numbers of any indicator using default parameters (just enter the name of the indicator you wish to explore and then chose the buffer numbers)
Hi mladen,
1. I try to use different timeframes in simple EA and have changed PERIOD_CURRENT to TimeFrame and wrote for TimeFrame; extern int TimeFrame = 0 //TimeFrame And it works, if I write 60 in EA it becomes 1H in indicator. But can I do it in some other way, perhaps with enums? I have looked here: https://docs.mql4.com/constants/chartconstants/enum_timeframes and tried a few combinations, but can't get it right.
2. If I would like to combine two settings or two indicators. For example if both are in downtrend then buy, and if one changes then sell. Is it hard? Can I use two hull_trend in some way? Is it enough to change something here in the code:
#define _doNothing 0#define _doBuy 1#define _doSell 2int start()
{
int doWhat = _doNothing;
double hull_trend_current = iCustom(NULL,0,"StepMA of rsi adaptive ema 2.8",PERIOD_CURRENT,RsiType,RsiLength,RsiPrice,Sensitivity,StepSize,Filter,FilterPeriod,FilterOn,10,BarToUse);
double hull_trend_previous = iCustom(NULL,0,"StepMA of rsi adaptive ema 2.8",PERIOD_CURRENT,RsiType,RsiLength,RsiPrice,Sensitivity,StepSize,Filter,FilterPeriod,FilterOn,10,BarToUse+1);
if (hull_trend_current!=hull_trend_previous)
if (hull_trend_current==1)
doWhat = _doBuy;
else doWhat = _doSell;
if (doWhat==_doNothing && !DisplayInfo) return(0);
I have a simple way estimating system...if I take a look @ it and feel even slightly nervous...I forgetaboutit...your picture makes me nervous
Let us make it more comfortable for your ease.
now you can better understand how these filtering out each other,when all two showing any same direction,dont change your mode when any single produce some false/short signal.
I am not sure that it can be done without over-complicating the whole thing
More or less that would be an EA already, not an indicator, but will see what can be done
Dearest MLADEN
A bit explaining my request/idea.
system 1 = true/false ....... // at one time only one system should be true.
system 2 = true/false
system 1 = check only ma 1
system 2 = check ma 1 + ma 2
when ma one (1) "averages - mtf - alerts 8.4" in orange color (sell/down trend)
condition=check for ma two (2)
if ma two (2) "StepMA of rsi adaptive ema 2.8" in orange color (sell/down trend)
open a sell order/trade.
same in opposite (for buy trade)
hope i explain well my request as an initial start.
regards
Hi mladen,
I tried to do an simple EA using simple trend (extended), and I tried to work from the simple EA using StepMA of rsi adaptive ema 2.8.
The EA gets no errors when I compile, but it don't open any trades. I don't know what I did wrong?
Hi mladen,
I also tried to make an simple EA from averages - mtf - alerts 8.4.ex4. And I think I understand a bit more now, all parameters from the indicator seem to work in the EA (or the opposite if you like). And now the EA opens order, but something is wrong with how it opens orders. It only opens sell orders, and not when it should.
Hi again :) (sorry for many questions)
What does the number 10 mean in :"double hull_trend_current = iCustom(NULL,0,"averages - mtf - alerts 8.4",PERIOD_CURRENT,CustomTF,AveragePeriod,PriceToUse,AverageMethod,DoubleSmoothedAverage,AdaptiveAverage,Filter,Filterapplied,10,BarToUse);"
before "BarToUse"? If I change it to 9 in simple EA from averages - mtf - alerts 8.4.ex4 it seems to work?
Hi again :) (sorry for many questions)
What does the number 10 mean in :"double hull_trend_current = iCustom(NULL,0,"averages - mtf - alerts 8.4",PERIOD_CURRENT,CustomTF,AveragePeriod,PriceToUse,AverageMethod,DoubleSmoothedAverage,AdaptiveAverage,Filter,Filterapplied,10,BarToUse);"
before "BarToUse"? If I change it to 9 in simple EA from averages - mtf - alerts 8.4.ex4 it seems to work?
That is the buffer number
Thanks! Is it correct to use number 9 in this example? How do I find the right buffer number?
Try using the buffers explorer (the attached) - that way you can see how many buffers are there, what are the values in the buffers and what are their numbers of any indicator using default parameters (just enter the name of the indicator you wish to explore and then chose the buffer numbers)
Try using the buffers explorer (the attached) - that way you can see how many buffers are there, what are the values in the buffers and what are their numbers of any indicator using default parameters (just enter the name of the indicator you wish to explore and then chose the buffer numbers)
Try using the buffers explorer (the attached) - that way you can see how many buffers are there, what are the values in the buffers and what are their numbers of any indicator using default parameters (just enter the name of the indicator you wish to explore and then chose the buffer numbers)
Hi mladen,
1. I try to use different timeframes in simple EA and have changed PERIOD_CURRENT to TimeFrame and wrote for TimeFrame;
extern int TimeFrame = 0 //TimeFrame
And it works, if I write 60 in EA it becomes 1H in indicator. But can I do it in some other way, perhaps with enums?
I have looked here:
https://docs.mql4.com/constants/chartconstants/enum_timeframes
and tried a few combinations, but can't get it right.
2. If I would like to combine two settings or two indicators. For example if both are in downtrend then buy, and if one changes then sell. Is it hard? Can I use two hull_trend in some way?
Is it enough to change something here in the code: