NexusFi: Find Your Edge


Home Menu

 





Convert Easy Language code into Thinkscript


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one RedK with 8 posts (3 thanks)
    2. looks_two sboarder13 with 6 posts (1 thanks)
    3. looks_3 mightyatom with 3 posts (0 thanks)
    4. looks_4 esslash with 1 posts (1 thanks)
      Best Posters
    1. looks_one esslash with 1 thanks per post
    2. looks_two GeorgeCgI with 1 thanks per post
    3. looks_3 RedK with 0.4 thanks per post
    4. looks_4 sboarder13 with 0.2 thanks per post
    1. trending_up 27,589 views
    2. thumb_up 6 thanks given
    3. group 9 followers
    1. forum 20 posts
    2. attach_file 6 attachments




 
Search this Thread

Convert Easy Language code into Thinkscript

  #21 (permalink)
GeorgeCgI
Brasov /Romania
 
Posts: 1 since Nov 2016
Thanks Given: 0
Thanks Received: 1


RedK View Post
although i would use this a little differently .. i would build the singals (the dots) in a way that when price goes above the short MA, i get 1st dot, then above 2nd MA, I get 2nd dot, then above 3rd MA i get a 3rd dot - and that means a full uptrend formation .. same going down ..

but i kept it the way it is.. thx,
RedK

Hello RedK, do u think you can convert a tos code into a MT4 for me pls? its the support& resistance, I used Tos befor but now they blocked for non US citizen so now I have to start using MT4 ...a bit for stone age looks this MT4..but it is what it is... so heres the code..many thanks if u can do it for me








declare upper;

input LookbackPeriod = 5;
input HideCurrentTF = no;
input HideTimeFrame2 = no;
input HideTimeFrame3 = no;
input TimeFrame2 = {default "15 MIN", "1 MIN", "2 MIN", "3 MIN", "4 MIN", "5 MIN", "10 MIN", "20 MIN", "30 MIN", "1 HOUR", "2 HOURS", "4 HOURS", DAY, "2 DAYS", "3 DAYS", "4 DAYS", WEEK, MONTH, "OPT EXP"};
input TimeFrame3 = {default "30 MIN", "1 MIN", "2 MIN", "3 MIN", "4 MIN", "5 MIN", "10 MIN", "15 MIN", "20 MIN", "1 HOUR", "2 HOURS", "4 HOURS", DAY, "2 DAYS", "3 DAYS", "4 DAYS", WEEK, MONTH, "OPT EXP"};
input HideSwings = no;
input SwingsLagBar = 1;

#--------------------------------------------------------------
def _highInPeriod1 = Highest(high, LookbackPeriod);
def _lowInPeriod1 = Lowest(low, LookbackPeriod);
#--------------------------------------------------------------
def marketLow1 = if _lowInPeriod1 < _lowInPeriod1[-LookbackPeriod] then _lowInPeriod1 else _lowInPeriod1[-LookbackPeriod];
def _markedLow1 = low == marketLow1;

rec _lastMarkedLow1 = CompoundValue(1, if IsNaN(_markedLow1) then _lastMarkedLow1[1] else if _markedLow1 then low else _lastMarkedLow1[1], low);
#--------------------------------------------------------------
def marketHigh1 = if _highInPeriod1 > _highInPeriod1[-LookbackPeriod] then _highInPeriod1 else _highInPeriod1[-LookbackPeriod];
def _markedHigh1 = high == marketHigh1;

rec _lastMarkedHigh1 = CompoundValue(1, if IsNaN(_markedHigh1) then _lastMarkedHigh1[1] else if _markedHigh1 then high else _lastMarkedHigh1[1], high);
#--------------------------------------------------------------
plot Resistance1 = _lastMarkedHigh1;
plot Support1 = _lastMarkedLow1;
#--------------------------------------------------------------
Resistance1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Resistance1.SetDefaultColor(Color.GREEN);
Resistance1.SetHiding(HideCurrentTF);
#--------------------------------------------------------------
Support1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Support1.SetDefaultColor(Color.RED);
Support1.SetHiding(HideCurrentTF);
#--------------------------------------------------------------
def LowSwingForw = Lowest(low, SwingsLagBar)[-SwingsLagBar];
def LowSwingBack = Lowest(low, LookbackPeriod)[1];
def SwingLow = if low < LowSwingForw and low <= LowSwingBack then 1 else 0;
plot LowSwing = if SwingLow then low else Double.NaN;
#--------------------------------------------------------------
def HighSwingForw = Highest(high, SwingsLagBar)[-SwingsLagBar];
def HighSwingBack = Highest(high, LookbackPeriod)[1];
def SwingHigh = if high > HighSwingForw and high >= HighSwingBack then 1 else 0;
plot HighSwing = if SwingHigh then high else Double.NaN;
#--------------------------------------------------------------
HighSwing.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
HighSwing.SetLineWeight(5);
HighSwing.SetDefaultColor(Color.RED);
HighSwing.SetHiding(HideSwings);
LowSwing.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
LowSwing.SetLineWeight(5);
LowSwing.SetDefaultColor(Color.GREEN);
LowSwing.SetHiding(HideSwings);
#--------------------------------------------------------------
Alert(HighSwing, "SupRes : Swing High", Alert.BAR, Sound.Bell);
Alert(LowSwing, "SupRes : Swing Low", Alert.BAR, Sound.Bell);
#--------------------------------------------------------------
AddLabel(HighSwing, "SupRes : Swing High", Color.RED);
AddLabel(LowSwing, "SupRes : Swing Low", Color.GREEN);
#--------------------------------------------------------------
def _highInPeriod2 = Highest(high(period = TimeFrame2), LookbackPeriod);
def _lowInPeriod2 = Lowest(low(period = TimeFrame2), LookbackPeriod);
#--------------------------------------------------------------
def marketLow2 = if _lowInPeriod2 < _lowInPeriod2[-LookbackPeriod] then _lowInPeriod2 else _lowInPeriod2[-LookbackPeriod];
def _markedLow2 = low(period = TimeFrame2) == marketLow2;

rec _lastMarkedLow2 = CompoundValue(1, if IsNaN(_markedLow2) then _lastMarkedLow2[1] else if _markedLow2 then low(period = TimeFrame2) else _lastMarkedLow2[1], low(period = TimeFrame2));
#--------------------------------------------------------------
def marketHigh2 = if _highInPeriod2 > _highInPeriod2[-LookbackPeriod] then _highInPeriod2 else _highInPeriod2[-LookbackPeriod];
def _markedHigh2 = high(period = TimeFrame2) == marketHigh2;

rec _lastMarkedHigh2 = CompoundValue(1, if IsNaN(_markedHigh2) then _lastMarkedHigh2[1] else if _markedHigh2 then high(period = TimeFrame2) else _lastMarkedHigh2[1], high(period = TimeFrame2));
#--------------------------------------------------------------
plot Resistance2 = _lastMarkedHigh2;
plot Support2 = _lastMarkedLow2;
#--------------------------------------------------------------
Resistance2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Resistance2.SetDefaultColor(Color.GREEN);
Resistance2.SetHiding(HideTimeFrame2);
#--------------------------------------------------------------
Support2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Support2.SetDefaultColor(Color.RED);
Support2.SetHiding(HideTimeFrame2);
#--------------------------------------------------------------
def _highInPeriod3 = Highest(high(period = TimeFrame3), LookbackPeriod);
def _lowInPeriod3 = Lowest(low(period = TimeFrame3), LookbackPeriod);
#--------------------------------------------------------------
def marketLow3 = if _lowInPeriod3 < _lowInPeriod3[-LookbackPeriod] then _lowInPeriod3 else _lowInPeriod3[-LookbackPeriod];
def _markedLow3 = low(period = TimeFrame3) == marketLow3;

rec _lastMarkedLow3 = CompoundValue(1, if IsNaN(_markedLow3) then _lastMarkedLow3[1] else if _markedLow3 then low(period = TimeFrame3) else _lastMarkedLow3[1], low(period = TimeFrame3));
#--------------------------------------------------------------
def marketHigh3 = if _highInPeriod3 > _highInPeriod3[-LookbackPeriod] then _highInPeriod3 else _highInPeriod3[-LookbackPeriod];
def _markedHigh3 = high(period = TimeFrame3) == marketHigh3;

rec _lastMarkedHigh3 = CompoundValue(1, if IsNaN(_markedHigh3) then _lastMarkedHigh3[1] else if _markedHigh3 then high(period = TimeFrame3) else _lastMarkedHigh3[1], high(period = TimeFrame3));
#--------------------------------------------------------------
plot Resistance3 = _lastMarkedHigh3;
plot Support3 = _lastMarkedLow3;
#--------------------------------------------------------------
Resistance3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Resistance3.SetDefaultColor(Color.GREEN);
Resistance3.SetHiding(HideTimeFrame3);
#--------------------------------------------------------------
Support3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
Support3.SetDefaultColor(Color.RED);
Support3.SetHiding(HideTimeFrame3);



and it looks something like this for me

it looks like this coz I remove SR2 and SR3 I just keel arrows and SR
Many thanks

Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
MC PL editor upgrade
MultiCharts
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
How to apply profiles
Traders Hideout
About a successful futures trader who didnĀ“t know anyth …
Psychology and Money Management
 




Last Updated on November 22, 2016


© 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