Thinkscript code for timed trigger - futures io
futures io futures trading



Thinkscript code for timed trigger


Discussion in ThinkOrSwim

Updated by dgo368
    1. trending_up 161 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 2 replies
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Thinkscript code for timed trigger

(login for full post details)
  #1 (permalink)
São Paulo + Brazil
 
 
Posts: 4 since Jul 2020
Thanks: 0 given, 1 received

Hello everyone,

I'm a Thinkorswim user, and I'm using MACD to give me buy and sell signals.

When MACD() "Value" crosses above "MACD() "Avg", it triggers a buy order.

I'm trying to create a code to trigger a sell order when MACD() "Value" is below "MACD() "Avg", after a buy order (that will be after a crossing above), but after a while. Because sometimes MACD will cross above and, with fluctuation, it will then go below again, so I need a way to confirm that it will not keep above and has to be sold, not hold.

I was thinking something like a code to trigger a buy order when MACD() "Value" is below "MACD() "Avg" on the closing of the current bar, or on the opening of the next one.

But the code can be anything simple that, after some time (like 1 bar duration), will trigger a sell order if it MACD() "Value" doesn't manage to keep itself above MACD() "Avg".

I hope it was easy to understand, does anyone know how to solve this?

Thank you.

Reply With Quote

 
 
(login for full post details)
  #2 (permalink)
Jackson, MS
 
 
Posts: 12 since Dec 2015
Thanks: 1 given, 2 received

Hello,
There are many MACD strategies available on the internet for thinkorswim, and 2 built into the platform itself. You can modify one of them to meet your idea. Research is a good pursuit, but I’ll save you time, none of them are profitable strategies.

Reply With Quote
 
(login for full post details)
  #3 (permalink)
São Paulo + Brazil
 
 
Posts: 4 since Jul 2020
Thanks: 0 given, 1 received


A person on reddit told me the solution was this one:

input waitingLength = 3;

def toBuy = MACD().Value is greater than MACD().Avg;

def toSell = MACD().Value < MACD().Avg and Sum(toBuy, waitingLength)[1] == 0;

plot Alert = toSell;

Can someone confirm that this would work as a sell conditional order for the situation I've mentioned?

Thanks

Reply With Quote


futures io Trading Community Platforms and Indicators ThinkOrSwim > Thinkscript code for timed trigger


August 3, 2020


Upcoming Webinars and Events
 

Live Video Panel: Ask Me Anything w/Ironbeam Brokerage

Aug 6
     



Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts