Questions many pine coders/traders have is, How to enter/exit trade as soon as trade condition is met i.e. do not wait till candle completion to enter/exit the trade. This strategy will help you to understand one of the way to achieve it.
This is an educational strategy to demonstrate, how one can trade based on tick data. This being a strategy based on tick data, it can be tested only on real time candles. This strategy will not take any trades on historical candles and cannot be used for back testing. All the strategy trades taken on real time candles will disappear (repainting) once chart is refreshed and new trades will be entered on real time candles.
The strategy will do nothing during off market hours and will not take any trades.
The strategy has been designed based on rules/inputs below: 1. Count the ticks from start of a candle till end of candle 2. Bifurcate ticks as up-ticks and down-ticks. If tick price is above previous tick price the tick is considered as up-tick and vice versa 3. Count the successive up-ticks and successive down-ticks
Strategy rules: 1. Track candle type (green or red) continuously on each tick (green candle is when latest tick price > previous tick price) 2. Take a long trade if work in progress (WIP) candle is green candle and we get successive up-ticks equal to user input ticks for trade 3. Take a short trade if work in progress (WIP) candle is red candle and we get successive down-ticks equal to user input ticks for trade 4. Exit the trade when we get successive ticks equal to user input ticks in opposite direction 5. Optionally for trade entry, user can decide whether to calculate successive up-ticks/down-ticks from beginning of candle or successive up-ticks/down-ticks anytime during the candle formation 6. Optionally for trade exit/square off, user can decide whether to apply exit rules on the entry candle or only from subsequent candle
Strategy setting: 1. '<Long on WIP Green candle and Short on WIP Red candle>' – This is just to describe when trades are entered. This parameter is not used for any calculation 2. 'No of successive ticks to enter the trade' – User input to decide, number of successive ticks for trade entry 3. 'Count successive ticks for trade only from start of candle' – check this to count successive ticks only from beginning of a candle 4. 'Exit if succussive ticks in opposite direction' - User input to decide, number of successive ticks in opposite direction for exiting the trade 5. 'Apply exit criteria on entry candle' – check to allow exit of trade on the entry candle, if un-checked, trade will not be exited on the entry candle i.e. opposite direction ticks will be counted from subsequent candle
Information below will be displayed continuously on the chart: 1. Candle no – Candles are counted from start of the trading session. This is current candle being formed on the chart 2. Candle now – This shows either ‘Green’ or ‘Red’ based on type of candle being formed 3. Tick count – This is current tick number being processed. Tick number starts from 1 for each new candle 4. Up-tick count – Number of up-ticks during formation of current candle 5. Down-tick count – Number of down-ticks during formation of current candle 6. Successive up-ticks – Current successive up-tick count 7. Successive down-ticks – Current successive down-tick count 8. Up-tick volume – Volume associated with up-ticks 9. Down-tick volume – Volume associated with down-ticks 10. Up-tick volume % - This is % of volume associated with up-ticks 11. Total volume – Candle volume till now. (Some times you might observe small difference between total volume and the volume shown by volume indicator. The difference could be because of refresh rate of your screen) 12. Candle completion % - This shows current candles completion %. This is candle progress from start of candle till close of candle
Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.
Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.