NexusFi: Find Your Edge


Home Menu

 





Think Or Swim Strategy COUNTS DAYS IN TRADE


Discussion in ThinkOrSwim

Updated
    1. trending_up 2,520 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread

Think Or Swim Strategy COUNTS DAYS IN TRADE

  #1 (permalink)
gemstoneartist
Klamath Falls, OR
 
Posts: 1 since Oct 2017
Thanks Given: 0
Thanks Received: 0

Hi, Guys,

I'm working on some strategies that require counting the number of days since the position was opened.

I've got code that will count bars (days) since the ENTRY_CONDITION was true:

def anchor_a = ENTRY_CONDITION;
def counter_a = if anchor_a[1] then 1 else counter_a[1] + 1;
def count_a = counter_a;

The problem with this is if the ENTRY_CONDITION becomes true again, it resets my counter and keeps me in the position longer than I want. I need a true BARS-IN-TRADE counter, and for some reason I can't seem to figure it out.

I've tried to use logic that checks both EntryPrice() and GetQuantity(), but neither of these things seems to be ABLE to be checked in a way that allows counting the days in the trade.

Thanks to anyone with a way to sort this.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Exit Strategy
NinjaTrader
MC PL editor upgrade
MultiCharts
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
35 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
19 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Spoo-nalysis ES e-mini futures S&P 500
14 thanks
  #2 (permalink)
 androsform 
New York, NY, United States
 
Experience: Advanced
Platform: ThinkOrSwim
Trading: Options
Posts: 2 since Jun 2014
Thanks Given: 2
Thanks Received: 1

Maybe you could try using a second counter?

Define it in the same ways..but then have it reference counter_a for its' value, and have it change itself of change counter a....; e.g. - if count b is less/greater than counter b [depending on trade side] to a certain range have it not do anything. Then if its' in-range of where you want to exit, have it overlay count a or have it plot then so you have a reference point.

Make sense?

Rishesh Singh
Professional Options Trader
www.stocktwits.com/androsform www.androstrades.com
Follow me on Twitter Reply With Quote




Last Updated on October 7, 2017


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts