NexusFi: Find Your Edge


Home Menu

 





NINO


Discussion in ThinkOrSwim

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




 
Search this Thread

NINO

  #1 (permalink)
Alcamo
san pedro ca. USA
 
Posts: 11 since May 2019
Thanks Given: 3
Thanks Received: 4

Is anyone familiar with "GandalProjectSystem" listed in Thinkorswim strategy. If you are , can you tell me your opinion and is there a way to modify and buy only when close is > than a long term MA, 50, 0r 100, or 200 day ma.? I am interested in backtesting but i dont know hoe to script it.
If you can modify can you help me with the script?
Thanl You
Anthony Vallone

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
MC PL editor upgrade
MultiCharts
Quant vue
Trading Reviews and Vendors
Cheap historycal L1 data for stocks
Stocks and ETFs
 
  #2 (permalink)
 kjhosken 
Seattle, WA/USA
 
Experience: Intermediate
Platform: TOS, TS
Trading: Forex, crude
Posts: 96 since Sep 2016
Thanks Given: 7
Thanks Received: 35

Here you go. I suggest you study this vs the original to start to see how to modify existing code to do what you want.

 
Code
input exitLength = 8;
input exitGainLength = 6;
input len = 50;
input avgtype = averageType.SIMPLE;
def averagePrice = ohlc4;
def medianPrice = hl2;
def medianBodyPrice = MidBodyVal();
def ma = movingAverage(avgtype,close, len);

def entryGandaldfPattern = (averagePrice[1] < medianPrice[1] and
    medianPrice[2] <= averagePrice[1] and
    medianBodyPrice[2] <= averagePrice[3]) or
    (averagePrice[1] < medianPrice[3] and
    medianBodyPrice < medianPrice[2] and
    medianBodyPrice[1] < medianBodyPrice[2]) and close > ma;

def exitGandalfPattern = (averagePrice[1] < medianBodyPrice[1] and
    medianPrice[2] == medianBodyPrice[3] and
    medianBodyPrice[1] <= medianBodyPrice[4]) or
    (averagePrice[2] < medianBodyPrice and
    medianPrice[4] <= averagePrice[3] and
    medianBodyPrice[1] <= averagePrice[1]);

def entryPrice = EntryPrice();
def priceChangeSinceEntry = close - entryPrice;
def afterEntryCount = if IsNaN(entryPrice[1]) and !IsNaN(entryPrice) then 1 else if !IsNaN(entryPrice) then afterEntryCount[1] + 1 else Double.NaN;

AddOrder(OrderType.BUY_TO_OPEN, entryGandaldfPattern, tickcolor = GetColor(1), arrowcolor = GetColor(1), name = "GandalfLE");
AddOrder(OrderType.SELL_TO_CLOSE, afterEntryCount > exitLength, tickcolor = GetColor(2), arrowcolor = GetColor(2), name = "GandalfTimeLX"); # check name
AddOrder(OrderType.SELL_TO_CLOSE, exitGandalfPattern and priceChangeSinceEntry < 0, tickcolor = GetColor(3), arrowcolor = GetColor(3), name = "GandalfLX");
AddOrder(OrderType.SELL_TO_CLOSE, afterEntryCount > exitGainLength and priceChangeSinceEntry > 0, tickcolor = GetColor(4), arrowcolor = GetColor(4), name = "GandalfTimeGainLX");

Follow me on Twitter Reply With Quote
Thanked by:
  #3 (permalink)
Alcamo
san pedro ca. USA
 
Posts: 11 since May 2019
Thanks Given: 3
Thanks Received: 4


CAN YOU PLEASE HELP
I am trying to find the lowest low of the last 7 days. The script below works fine (partially) but is there a shorter way to script line two. Also line 3 looks for lowest low greater than low[7] by .009%. I reality i am looking for todays low which is higher or lower than low[7] by .009%. I know very little about TOS script language. The script below is part of a strategy written for me by a freelance programmer and i am trying to correct several issues and maybe utilize it and use as a scanner . Thank you in advance for your answer to the three above questions.

def dbbtsx_c1 = close > open ;
def dbbtsx_c2 = low < low[1] and low < low[2] and low < low[3] and low < low[4] and low < low[5] and low < low[6] and low[6] > low[7] and low[7] < low[8] ;
def dbbtsx_c3 = (low ) < .009 * low[7] + low[7];
def dbbtsx_c5 = low > low[7];
def dbbtsx_c6 = low [6] > low[7];
def dbbtsx = dbbtsx_c1 and dbbtsx_c2 and dbbtsx_c3 and dbbtsx_c5;
#plot sling_p = sling and ShowSling;
#sling_p.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
AddChartBubble(ShowBubble and dbbtsx and mc and Showdbbtsx, high, "dbbtsx", Color.YELLOW);

Reply With Quote




Last Updated on October 10, 2021


© 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