NexusFi: Find Your Edge


Home Menu

 





Rec usaged is not allowed in this context


Discussion in ThinkOrSwim

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




 
Search this Thread

Rec usaged is not allowed in this context

  #1 (permalink)
BombaFett
San Francisco, CA, USA
 
Posts: 2 since Jan 2017
Thanks Given: 0
Thanks Received: 0

Demigods,

I have the following code I use as a trailing stop loss:

 
Code
#ATR Stoploss
input Length = 20;
input ATRFactor = 3;
input AverageType = AverageType.WILDERS;

def HiLo = Min(high - low, 1.5 * Average(high - low, Length));
def HRef = if low <= High[1]
    then high - close[1]
    else (high - close[1]) - 0.5 * (low - high[1]);
def LRef = if high >= low[1]
    then close[1] - low
    else (close[1] - low) - 0.5 * (low[1] - high);

def TrueRange;
    TrueRange = Max(HiLo, Max(HRef, LRef));

def ATR = ATRFactor*MovingAverage(AverageType, TrueRange, Length);

def trail;
    if (close()[1] > trail[1]) {
    trail = Max(trail[1], close - ATR);
    } else {
    trail = Min(trail[1], close - ATR);
    }

plot TrailingStop = trail;
When I build a conditional sell order in the Study Order Condition screen, I set it up as the following:

 
Code
close crosses below ATRTrailingStop_UPTREND_v2()
My problem is, seemingly at random, I'll get an error message stating "rec usage is not allowed in this context". Twice now, I've built this study from scratch, testing to see if the order will pass with each change and it'll work, but then it seems as if it just decides it doesn't want to work anymore.

For example, I set the order up last night and it worked perfectly this morning. When I tied to setup my next order, I get the error message. What am I dong wrong? I'm stumped...HALP

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
Exit Strategy
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
NexusFi Journal Challenge - May 2024
Feedback and Announcements
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
48 thanks
Just another trading journal: PA, Wyckoff & Trends
35 thanks
Tao te Trade: way of the WLD
25 thanks
Bigger Wins or Fewer Losses?
24 thanks
GFIs1 1 DAX trade per day journal
21 thanks
  #2 (permalink)
jbalint
Madison WI
 
Posts: 1 since Jun 2017
Thanks Given: 2
Thanks Received: 0

your definition of trail references the previous value. this is called a recursive reference. according to the docs (at the very bottom here), this is not allowed in conditional orders: (add http colon slash slash) tlc.thinkorswim.com/center/howToTos/thinkManual/Trade/Order-Entry-Tools/conditionalorders.html

Reply With Quote
  #3 (permalink)
Tradin
Atlanta Georgia
 
Posts: 1 since Jul 2020
Thanks Given: 0
Thanks Received: 0


Is there a broker other than TOS/Ameritrade that will allow rec usage? Or were you able to find a work around? Trying to find someplace to use an ATR trailstop to close an open position automatically with a conditional/coded orders. I keep getting this recursive data not allowed message too, and I guess will need to switch to another broker that will if possible. Thanks in advance for any help

Reply With Quote




Last Updated on July 25, 2020


© 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