Could use some help with a coding issue
Posted: Mon Feb 01, 2021 10:25 am
Hello:
I was hoping someone could help me with a coding issue I am having:
When a trigger occurs, I am trying to draw a continuous horizontal line from that close until the next trigger occurs - then it will again draw a horizontal line from that close until the next trigger.
I thought it would be like:
trigger := if (cross(close,ma(close,30),1,0);.....................................(produce the trigger and get a 1 or 0 result)
b := barssince(trigger);.................................................................... (find out the amount of bars since the trigger happened)
horizontal_line : ref(close,b);........................................................ (have it draw a continuous horizontal line at the close where the trigger happened until the next trigger
This is easily done in the Think or Swim platform - but I am having trouble trying to code it in this Formula Script
Thanks,
Brian
I was hoping someone could help me with a coding issue I am having:
When a trigger occurs, I am trying to draw a continuous horizontal line from that close until the next trigger occurs - then it will again draw a horizontal line from that close until the next trigger.
I thought it would be like:
trigger := if (cross(close,ma(close,30),1,0);.....................................(produce the trigger and get a 1 or 0 result)
b := barssince(trigger);.................................................................... (find out the amount of bars since the trigger happened)
horizontal_line : ref(close,b);........................................................ (have it draw a continuous horizontal line at the close where the trigger happened until the next trigger
This is easily done in the Think or Swim platform - but I am having trouble trying to code it in this Formula Script
Thanks,
Brian