I have created a version of this to use different prices for upper and lower bands as an experiment. If you are ok, I can upload to this thread.Centaur wrote: Tue Oct 11, 2022 7:27 am G-Channels
Think this indicator will work great for both baseline and secondary confirmation. It really keeps you in a trend.
Will do an MTF version of it.
Re: No Nonsense Forex - Indicators
62
Sure, no objectionsxpf2003 wrote: Fri Oct 21, 2022 10:11 am I have created a version of this to use different prices for upper and lower bands as an experiment. If you are ok, I can upload to this thread.
半人馬座
Bàn rénmǎzuò
If you enjoy my work please hit the like button, to show some support.
All comments, criticism, advise or general ideas are more than welcome. In fact its crucial to have a continues learning / developing mechanism not just for me but all fellow market enthusiasts.
Bàn rénmǎzuò
If you enjoy my work please hit the like button, to show some support.
All comments, criticism, advise or general ideas are more than welcome. In fact its crucial to have a continues learning / developing mechanism not just for me but all fellow market enthusiasts.
Re: No Nonsense Forex - Indicators
63Had a look at several OTT versions and think I'll code this one: https://www.tradingview.com/script/5qkK ... HOTT-LOTT/tradd wrote: Sat Oct 15, 2022 5:35 pm Hi Centaur,
Thanks for Alphatrend Mt5. Could you convert another popular Tradingview script as OTT to Mt5 ?
https://www.tradingview.com/script/zVhoDQME/
Thanks.
半人馬座
Bàn rénmǎzuò
If you enjoy my work please hit the like button, to show some support.
All comments, criticism, advise or general ideas are more than welcome. In fact its crucial to have a continues learning / developing mechanism not just for me but all fellow market enthusiasts.
Bàn rénmǎzuò
If you enjoy my work please hit the like button, to show some support.
All comments, criticism, advise or general ideas are more than welcome. In fact its crucial to have a continues learning / developing mechanism not just for me but all fellow market enthusiasts.
Re: No Nonsense Forex - Indicators
64Here you go - you can choose a different price for upper band and lower band of the channel
- These users thanked the author xpf2003 for the post (total 2):
- Centaur, pipsquirrel
Re: No Nonsense Forex - Indicators
65Added all the prices, to the version you posted.xpf2003 wrote: Fri Oct 21, 2022 7:26 pm Here you go - you can choose a different price for upper band and lower band of the channel
G-Channel-Diff-Price-Option.png
- These users thanked the author mrtools for the post (total 6):
- Jedidiah, thomdel, xpf2003, pipsquirrel, Mrs.Watanabe, saishala
Re: No Nonsense Forex - Indicators
66Market Close Error
Question to all mql5 coders, how can one check if the market is open and ready to take trades without defining trading hours? Common problem swap fee calculations of broker at 00:00 preventing trades from being placed especially on the daily timeframe..
Question to all mql5 coders, how can one check if the market is open and ready to take trades without defining trading hours? Common problem swap fee calculations of broker at 00:00 preventing trades from being placed especially on the daily timeframe..
半人馬座
Bàn rénmǎzuò
If you enjoy my work please hit the like button, to show some support.
All comments, criticism, advise or general ideas are more than welcome. In fact its crucial to have a continues learning / developing mechanism not just for me but all fellow market enthusiasts.
Bàn rénmǎzuò
If you enjoy my work please hit the like button, to show some support.
All comments, criticism, advise or general ideas are more than welcome. In fact its crucial to have a continues learning / developing mechanism not just for me but all fellow market enthusiasts.
Re: No Nonsense Forex - Indicators
67Are you getting this error while running your EA on daily timeframe? I had this as well. I then noticed that I also was getting this error on every timeframe for the bar that opens at midnight.Centaur wrote: Sun Oct 23, 2022 4:43 pm Market Close Error
Question to all mql5 coders, how can one check if the market is open and ready to take trades without defining trading hours? Common problem swap fee calculations of broker at 00:00 preventing trades from being placed especially on the daily timeframe..
If it is the same thing, I have managed to fix my EA. Happy to post the details here a bit later as I am on the move and not near my laptop
Re: No Nonsense Forex - Indicators
68All timeframes at midnight, please your assistance will be greatly appreciated...xpf2003 wrote: Sun Oct 23, 2022 7:25 pm Are you getting this error while running your EA on daily timeframe? I had this as well. I then noticed that I also was getting this error on every timeframe for the bar that opens at midnight.
If it is the same thing, I have managed to fix my EA. Happy to post the details here a bit later as I am on the move and not near my laptop
半人馬座
Bàn rénmǎzuò
If you enjoy my work please hit the like button, to show some support.
All comments, criticism, advise or general ideas are more than welcome. In fact its crucial to have a continues learning / developing mechanism not just for me but all fellow market enthusiasts.
Bàn rénmǎzuò
If you enjoy my work please hit the like button, to show some support.
All comments, criticism, advise or general ideas are more than welcome. In fact its crucial to have a continues learning / developing mechanism not just for me but all fellow market enthusiasts.
Re: No Nonsense Forex - Indicators
69Sorry for the late post. It was a bit busy at work and at home.Centaur wrote: Mon Oct 24, 2022 5:02 pm All timeframes at midnight, please your assistance will be greatly appreciated...
Disclaimer - This is what I observed in my case and how I fixed the issue I was facing. If this fix does not work for you, let me know. I am happy to take a look at your issue.
Let's first understand what is causing this error. Let's use the GBPUSD example on IC Markets international. If you look at the symbol specification, then you will notice that the symbol cannot be traded for 2 minutes between 23:59 and 00:01. Midnight is bang in the middle of this.
If you are like me and using the OnTick function in your EA, you would naively think this is ok as you would not get a tick during those 2 minutes. But you would be wrong. You will get ticks in those 2 minutes. This is for 2 reasons
(1) Those times are untradable for you as a retail trader but IC Markets may have trading activity going on during those 2 minutes. It is just that you are not allowed to participate
(2) It is possible that these trading times were not always like that. They have changed recently but your historical data will not be changed to reflect this. Meaning, you may have historical data for those 2 minutes which results in the [market closed] error when you run your EA in the strategy tester
How did I fix this?
I will not be able to share all my code as is. It contains a lot of other pieces that will come in the way of explaining this. I will instead use pseudocode to describe.
My OnTick function looks like this
Code: Select all
void OnTic() {
Strategy.OnTick();
if(NewBar()) {
Strategy.OnNewBar();
}
}
You can fix this by using a timer here. I hope you can imagine how messy that code would have become with a lot of symbol specific hard-coding.
I needed a way to invoke OnNewBar() function during the same bar but after the market has opened but only if I have received a [market closed] error before. What I ended up doing was returning a boolean true/false from my Strategy.OnNewBar() function. It returns false if the order send fails for any reason (you can be specific and return false only when [market closed] error is returned). I then changed my OnTick function below
Code: Select all
bool LastOnNewBarResult = true;
void OnTic() {
Strategy.OnTick();
if(LastOnNewBarResult == false) {
LastOnNewBarResult = Strategy.OnNewBar();
}
if(NewBar()) {
LastOnNewBarResult = Strategy.OnNewBar();
}
}
- These users thanked the author xpf2003 for the post (total 2):
- Centaur, berserkyjc
Re: No Nonsense Forex - Indicators
70Really interesting approach, I've also done some reading and they suggest using the function SymbolInfoSessionTrade, so I came up with the following function (seems to be working so far):xpf2003 wrote: Wed Oct 26, 2022 8:31 am Sorry for the late post. It was a bit busy at work and at home.
Disclaimer - This is what I observed in my case and how I fixed the issue I was facing. If this fix does not work for you, let me know. I am happy to take a look at your issue.
Let's first understand what is causing this error. Let's use the GBPUSD example on IC Markets international. If you look at the symbol specification, then you will notice that the symbol cannot be traded for 2 minutes between 23:59 and 00:01. Midnight is bang in the middle of this.
GBPUSD.png
If you are like me and using the OnTick function in your EA, you would naively think this is ok as you would not get a tick during those 2 minutes. But you would be wrong. You will get ticks in those 2 minutes. This is for 2 reasons
(1) Those times are untradable for you as a retail trader but IC Markets may have trading activity going on during those 2 minutes. It is just that you are not allowed to participate
(2) It is possible that these trading times were not always like that. They have changed recently but your historical data will not be changed to reflect this. Meaning, you may have historical data for those 2 minutes which results in the [market closed] error when you run your EA in the strategy tester
How did I fix this?
I will not be able to share all my code as is. It contains a lot of other pieces that will come in the way of explaining this. I will instead use pseudocode to describe.
My OnTick function looks like this
So I pass every tick to my Strategy class and then if this tick is on a new bar then I invoke the OnNewBar function of my Strategy class. The tick that comes at midnight, triggers my new bar logic resulting in the OnNewBar function in my Strategy class being called. If my entry conditions are met, then the Strategy class tries to place an order and fails with error [marekt closed]Code: Select all
void OnTic() { Strategy.OnTick(); if(NewBar()) { Strategy.OnNewBar(); } }
You can fix this by using a timer here. I hope you can imagine how messy that code would have become with a lot of symbol specific hard-coding.
I needed a way to invoke OnNewBar() function during the same bar but after the market has opened but only if I have received a [market closed] error before. What I ended up doing was returning a boolean true/false from my Strategy.OnNewBar() function. It returns false if the order send fails for any reason (you can be specific and return false only when [market closed] error is returned). I then changed my OnTick function below
What this is doing is - if Strategy.OnNewBar() returns false, then Strategy.OnNewBar() is called on every tick until it returns true.Code: Select all
bool LastOnNewBarResult = true; void OnTic() { Strategy.OnTick(); if(LastOnNewBarResult == false) { LastOnNewBarResult = Strategy.OnNewBar(); } if(NewBar()) { LastOnNewBarResult = Strategy.OnNewBar(); } }
Code: Select all
//+------------------------------------------------------------------+
//| Function: Check if market is Open |
//+------------------------------------------------------------------+
bool MarketOpen()
{
datetime from = 0;
datetime to = 0;
datetime now = TimeCurrent();
uint session_index = 0;
MqlDateTime today;
TimeToStruct(now, today);
if(SymbolInfoSessionTrade(_Symbol, (ENUM_DAY_OF_WEEK) today.day_of_week, session_index, from, to))
{
MqlDateTime from_time;
MqlDateTime to_time;
TimeToStruct(from, from_time);
TimeToStruct(to, to_time);
int from_time_seconds = from_time.sec + from_time.min * 60 + from_time.hour * 3600;
int to_time_seconds = to_time.sec + to_time.min * 60 + to_time.hour * 3600;
int now_seconds = today.sec + today.min * 60 + today.hour * 3600;
if(now_seconds >= from_time_seconds && now_seconds <= to_time_seconds)
return(true);
return(false);
}
return(false);
}
半人馬座
Bàn rénmǎzuò
If you enjoy my work please hit the like button, to show some support.
All comments, criticism, advise or general ideas are more than welcome. In fact its crucial to have a continues learning / developing mechanism not just for me but all fellow market enthusiasts.
Bàn rénmǎzuò
If you enjoy my work please hit the like button, to show some support.
All comments, criticism, advise or general ideas are more than welcome. In fact its crucial to have a continues learning / developing mechanism not just for me but all fellow market enthusiasts.