Re: No Nonsense Forex - Indicators

71
Centaur wrote: Thu Oct 27, 2022 1:25 am Really 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):

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);
  }
So you are basically checking if the current time is within the allowed trading session time for that symbol.

That is a nice idea. I can extend my code to first check if trading is allowed and then call OrderSend. If trading is not allowed, I can do what I have mentioned in my post above.


Re: No Nonsense Forex - Indicators

72
xpf2003 wrote: Thu Oct 27, 2022 1:48 am So you are basically checking if the current time is within the allowed trading session time for that symbol.

That is a nice idea. I can extend my code to first check if trading is allowed and then call OrderSend. If trading is not allowed, I can do what I have mentioned in my post above.
Yes sounds like a working solution
半人馬座
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

75
Daim2574 wrote: Sun Oct 30, 2022 4:08 am Just a gentle reminder… thanks again

Dear mrtools… Could you please color the upper and lower bands based on slope similar to what you are doing for the middle line… thanks a lot
Hi Daim2574,

This is mainly Centaur's thread and really don't want to get in the way of the excellent work he is doing in here.
These users thanked the author mrtools for the post (total 2):
xpf2003, Centaur


Re: No Nonsense Forex - Indicators

78
Donchian Trend Ribbon
Converted tradingview indicator: https://www.tradingview.com/script/PxLq ... nd-Ribbon/
These users thanked the author Centaur for the post (total 2):
Jedidiah, thomdel
半人馬座
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

79
Centaur wrote: Thu Nov 03, 2022 11:57 pm Donchian Trend Ribbon
Converted tradingview indicator: https://www.tradingview.com/script/PxLq ... nd-Ribbon/
Very crude coding, will look at a more compact coding method. Best settings I think is 10, all dependent on your system.
半人馬座
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.


Who is online

Users browsing this forum: No registered users and 6 guests