Overnight Positioning w EMA - Strategy [presentTrading]I've recently started researching Market Timing strategies, and it’s proving to be quite an interesting area of study. The idea of predicting optimal times to enter and exit the market, based on historical data and various indicators, brings a dynamic edge to trading. Additionally, it is integrated with the 3commas bot for automated trade execution.
I'm still working on it. Welcome to share your point of view.
█ Introduction and How it is Different
The "Overnight Positioning with EMA " is designed to capitalize on market inefficiencies during the overnight trading period. This strategy takes a position shortly before the market closes and exits shortly after it opens the following day. What sets this strategy apart is the integration of an optional Exponential Moving Average (EMA) filter, which ensures that trades are aligned with the underlying trend. The strategy provides flexibility by allowing users to select between different global market sessions, such as the US, Asia, and Europe.
It is integrated with the 3commas bot for automated trade execution and has a built-in mechanism to avoid holding positions over the weekend by force-closing positions on Fridays before the market closes.
BTCUSD 20 mins Performance
█ Strategy, How it Works: Detailed Explanation
The core logic of this strategy is simple: enter trades before market close and exit them after market open, taking advantage of potential price movements during the overnight period. Here’s how it works in more detail:
🔶 Market Timing
The strategy determines the local market open and close times based on the selected market (US, Asia, Europe) and adjusts entry and exit points accordingly. The entry is triggered a specific number of minutes before market close, and the exit is triggered a specific number of minutes after market open.
🔶 EMA Filter
The strategy includes an optional EMA filter to help ensure that trades are taken in the direction of the prevailing trend. The EMA is calculated over a user-defined timeframe and length. The entry is only allowed if the closing price is above the EMA (for long positions), which helps to filter out trades that might go against the trend.
The EMA formula:
```
EMA(t) = +
```
Where:
- EMA(t) is the current EMA value
- Close(t) is the current closing price
- n is the length of the EMA
- EMA(t-1) is the previous period's EMA value
🔶 Entry Logic
The strategy monitors the market time in the selected timezone. Once the current time reaches the defined entry period (e.g., 20 minutes before market close), and the EMA condition is satisfied, a long position is entered.
- Entry time calculation:
```
entryTime = marketCloseTime - entryMinutesBeforeClose * 60 * 1000
```
🔶 Exit Logic
Exits are triggered based on a specified time after the market opens. The strategy checks if the current time is within the defined exit period (e.g., 20 minutes after market open) and closes any open long positions.
- Exit time calculation:
exitTime = marketOpenTime + exitMinutesAfterOpen * 60 * 1000
🔶 Force Close on Fridays
To avoid the risk of holding positions over the weekend, the strategy force-closes any open positions 5 minutes before the market close on Fridays.
- Force close logic:
isFriday = (dayofweek(currentTime, marketTimezone) == dayofweek.friday)
█ Trade Direction
This strategy is designed exclusively for long trades. It enters a long position before market close and exits the position after market open. There is no shorting involved in this strategy, and it focuses on capturing upward momentum during the overnight session.
█ Usage
This strategy is suitable for traders who want to take advantage of price movements that occur during the overnight period without holding positions for extended periods. It automates entry and exit times, ensuring that trades are placed at the appropriate times based on the market session selected by the user. The 3commas bot integration also allows for automated execution, making it ideal for traders who wish to set it and forget it. The strategy is flexible enough to work across various global markets, depending on the trader's preference.
█ Default Settings
1. entryMinutesBeforeClose (Default = 20 minutes):
This setting determines how many minutes before the market close the strategy will enter a long position. A shorter duration could mean missing out on potential movements, while a longer duration could expose the position to greater price fluctuations before the market closes.
2. exitMinutesAfterOpen (Default = 20 minutes):
This setting controls how many minutes after the market opens the position will be exited. A shorter exit time minimizes exposure to market volatility at the open, while a longer exit time could capture more of the overnight price movement.
3. emaLength (Default = 100):
The length of the EMA affects how the strategy filters trades. A shorter EMA (e.g., 50) reacts more quickly to price changes, allowing more frequent entries, while a longer EMA (e.g., 200) smooths out price action and only allows entries when there is a stronger underlying trend.
The effect of using a longer EMA (e.g., 200) would be:
```
EMA(t) = +
```
4. emaTimeframe (Default = 240):
This is the timeframe used for calculating the EMA. A higher timeframe (e.g., 360) would base entries on longer-term trends, while a shorter timeframe (e.g., 60) would respond more quickly to price movements, potentially allowing more frequent trades.
5. useEMA (Default = true):
This toggle enables or disables the EMA filter. When enabled, trades are only taken when the price is above the EMA. Disabling the EMA allows the strategy to enter trades without any trend validation, which could increase the number of trades but also increase risk.
6. Market Selection (Default = US):
This setting determines which global market's open and close times the strategy will use. The selection of the market affects the timing of entries and exits and should be chosen based on the user's preference or geographic focus.
Europe
30 Second Futures Session Open RangeThis indicator displays 30 second opening ranges from Globex, Europe, and RTH sessions.
From the RTH session range, it also displays infinitely generating Price Targets based on a % of the opening range size.
I am retrieving the 30 second data using the new "request.security_lower_tf()" function.
The importance of these levels is based on the idea that when the market opens, algorithms establish their positions within the first 30 seconds.
These areas can also be seen as potential areas of support and resistance throughout the sessions.
Enjoy!
BTC Europe-America-Asia market backgrounds - 1h max frameMarket indicator - Europe - America - Asia.
Based on my trading experience. Therefore, time zones are of different sizes.
Hotch SessionSimple Session timer with separate session for Asia, Europe, and the Americas plus an extra custom session timer. each can be turned on and off separately.
The indicator also plots the highs and lows of each session.
This code was modified from the Session timer code found in the original "The Arty" by PheonixBinary but expanded to better include all trading sessions.
The code was written in a manner to be as compact as possible. I had looked at many other Session timers and found entire input sections that were longer than the entirety of this indicator.
Please feel free to use this code in any manner you choose permission not required.
Global Trend [BEA]Do you Ever Wonder How world Market/indices are Performing Before your Market Open?
This indicator consist of 30 Major global indices and 10 local Indices which will help you get a idea of the direction of the global markets. So basically I have calculate the % change for each bar, then I am calculating the weightage of positive change with respect to total % change for all four markets separately .
How to use this indicator?
As per my experience , each regional market will follow the global trend , so I think the the local markets will tends to converge towards the average of all four market trend ( I am situated in Asia , so you need to do your own research before using this indicator )
Following four markets are being plotted :
American Market
Asian Market
European Market
Local Market
I have provided inputs to select the indices , you can change the local index as per your location.
You can choose whichever market trend you want to display.
In the following image i have selected the American market and Local market
In the following image i have selected the American market and Local market
Sources & refences :
Big thank to www.pinecoders.com and kodify.net
DISCLAIMER
Any and all liability for risks resulting from investment transactions or other asset dispositions carried out by the user based on information received or a market analysis is expressly excluded by me.
All the information made available here is generally provided to serve as an example only, without obligation and without specific recommendations for action. It does not constitute and cannot replace investment advice. We therefore recommend that you contact your personal financial advisor before carrying out specific transactions and investments.
Do your own research, This is not a financial advice.
AltSessionHello World
It’s no secret that trading sessions play a massive role in market movement and liquidity. We can clearly see in the image about how important identifying international trading hours are for a trader.
The Asian session starts around 1am GMT and often has a bearish bias through this session lasting for a few hours, after which Frankfurt and London traders start to come online and can often reverse the Asian sentiment.
The London session is the best session to trade traditionally starting around 7am GMT before the American traders come online and reverse market once again.
We have designed this indicator to help identify different trading hours easily with a background shade on the chart and also high/lows of the training session, as these levels can often be revisited.
We hope you find this indicator useful and please feel free to drop a comment if you have any updates you wish to be made or any future indicator script ideas, thank you.
COVID-19: Daily change per capita (EU only)New confirmed cases per day (daily change) is one thing, just an absolute value but when we put this number in context of population (per million people) of each country the situation is a bit different.
We can easily see that, at the moment (Apr 2nd, 2020), the most affected country is Spain (~150 new cases per million people per day) and surprisingly the second one is Switzerland (CH). We can also see Spain or Belgium's steep curve relative to other countries.
I know that some countries run more tests than the others and the outcome might not be reflect the reality but this is the official data that is available.