Sharad_Gaikwad

Tick Strategy

Tick Strategy:

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



开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?