NexusFi: Find Your Edge


Home Menu

 





cycle indicator


Discussion in EasyLanguage Programming

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




 
Search this Thread

cycle indicator

  #1 (permalink)
tsxela
modena italy
 
Posts: 2 since Jul 2014
Thanks Given: 1
Thanks Received: 0

I would know if it is possible to adapte this code from TS (9.1) to Multichart :

var: Docking("");
var: Candlewid(0);

{ COLORS }

var: orange(rgb(255, 65, 0));
var: skyblue(rgb(75, 206, 250));
var: gold(rgb(255, 180, 40));
var: pink(rgb(255, 165, 255));

var: PinkFac(0), GoldFac(0), BlueFac(0), OrangeFac(0), CyanFac(0);
var: freqPink(0), freqGold(0), freqBlue(0), freqOrange(0), freqCyan(0);
var: ampPink(0), ampGold(0), ampBlue(0), ampOrange(0), ampCyan(0);

var: ok2recalc(false);
var:
Button btnRestore(null),
Form frmMain(Null);

const:
frm.width( 400 ), frm.height( 600 ),
btn.width( 60 ), btn.height( 20 ),
lbl.width( 30 ), lbl.height( 15 ),
txt.width( 60 ), txt.height( 15 ), widetxt.width( 180 ),
cbo.width( 80 ), cbo.height( 30 ),
chk.width( 20 ), chk.height( 20 ), widechk.width( 120 ),
rdo.width( 80 ), rdo.height( 15 ),
spn.width( 33 ), spn.height( 30 ),
widelbl.width( 60 ), widelbl.height( 30 ),
bigbtn.width( 80 ), bigbtn.height( 30 ),
spacer( 3 ),
columnwidth( 100 );

Const: lblwidfac(1.1);
const: chkAdjust(3), spnAdjust(0);

var: shiftPink(2);
var: shiftGold(shiftPink*3);
var: shiftBlue(shiftGold*3);
var: shiftOrange(shiftBlue*3);
var: shiftCyan(shiftOrange*3);

const: avgbb(8);
var: cyclewid(1); //Once If StringContains(ShoCycle,"O") or StringContains(ShoCycle,"C") then cyclewid = 0;
var: freq(0);
var: plotfac(100000); // quick and dirty way to plot on forex, es and nq

If chkShoCyclePink <> null then begin
var: basePink(0); basePink = cosine(freq/freqPink * (currentbar));
var: baseGold(0); baseGold = cosine(freq/freqGold * (currentbar));
var: baseBlue(0); baseBlue = cosine(freq/freqBlue * (currentbar));
var: baseOrange(0); baseOrange = cosine(freq/freqOrange * (currentbar));
var: baseCyan(0); baseCyan = cosine(freq/freqCyan * (currentbar));

var: cyclePink(0); cyclePink = baseCyan*ampCyan + baseOrange*ampOrange + Baseblue*ampBlue + baseGold*ampGold + basePink*(ampPink);
var: cycleGold(0); cycleGold = baseCyan*ampCyan + baseOrange*ampOrange + Baseblue*ampBlue + baseGold*(ampPink+ampGold);
var: cycleBlue(0); cycleBlue = baseCyan*ampCyan + baseOrange*ampOrange + baseblue*(ampPink+ampGold+ampBlue);
var: cycleOrange(0); cycleOrange = baseCyan*ampCyan + baseorange*(ampPink+ampGold+ampBlue+ampOrange);
var: cycleCyan(0); cycleCyan = baseCyan*(ampPink+ampGold+ampBlue+ampOrange+ampCyan);

If chkShoCyclePink.Checked then begin
plot11(plotfac*cyclePink,"p11",pink,default,cyclewid);
If chkShoObosPink.checked then begin
If basePink > .85 and basePink > basePink[1] then
plot11(plot11,"p11",default,default,5);
If basePink < -.85 and basePink < basePink[1] then
plot11(plot11,"p11",default,default,5);
end;
end;

If chkShoCycleGold.Checked then begin
plot12(plotfac*cycleGold[shiftGold],"p12",gold,default,cyclewid);
If chkShoObosGold.checked then begin
If baseGold[shiftGold] > .85 and baseGold[shiftGold] > baseGold[shiftGold+1] then
plot12(plot12,"p12",default,default,5);
If baseGold[shiftGold] < -.85 and baseGold[shiftGold] < baseGold[shiftGold+1] then
plot12(plot12,"p12",default,default,5);
end;
end;

If chkShoCycleBlue.Checked then begin
plot13(plotfac*cycleBlue[shiftBlue],"p13",skyblue,default,cyclewid);
If chkShoObosBlue.checked then begin
If baseBlue[shiftBlue] > .85 and baseBlue[shiftBlue] > baseBlue[shiftBlue+1] then
plot13(plot13,"p13",default,default,5);
If baseBlue[shiftBlue] < -.85 and baseBlue[shiftBlue] < baseBlue[shiftBlue+1] then
plot13(plot13,"p13",default,default,5);
end;
end;

If chkShoCycleOrange.Checked then begin
plot14(plotfac*cycleOrange[shiftOrange],"p14",orange,default,cyclewid);
If chkShoObosOrange.checked then begin
If baseOrange[shiftOrange] > .85 and baseOrange[shiftOrange] > baseOrange[shiftOrange+1] then
plot14(plot14,"p14",default,default,5);
If baseOrange[shiftOrange] < -.85 and baseOrange[shiftOrange] < baseOrange[shiftOrange+1] then
plot14(plot14,"p14",default,default,5);
end;
end;

If chkShoCycleCyan.Checked then begin
plot15(plotfac*cycleCyan[shiftCyan],"p15",darkcyan,default,cyclewid);
If chkShoObosCyan.checked then begin
If baseCyan[shiftCyan] > .75 and baseCyan[shiftCyan] > baseCyan[shiftCyan+1] then
plot15(plot15,"p15",default,default,5);
If baseCyan[shiftCyan] < -.75 and baseCyan[shiftCyan] < baseCyan[shiftCyan+1] then
plot15(plot15,"p15",default,default,5);
end;
end;

var: Vector vcc(null); Once vcc = New vector;
If not appstorage["rdoNone.checked"] astype bool then begin
var: price(0); price = baseCyan*ampCyan + baseOrange*ampOrange + Baseblue*ampBlue + baseGold*ampGold + basePink*(ampPink);
var: rng(0); Once rng = (spnBarRange.value/100)*(ampPink+ampGold+ampBlue+ampOrange+ampCyan);
If mod(currentbar,spnBarSeparation.Value) = 0 then begin
var: hh(0); hh = price+random(rng);
var: ll(0); ll = price-random(rng);
If hh < ll[1] then hh = ll[1];
If ll > hh[1] then ll = hh[1];
var: cc(0); cc = oo_iff(price>price[1],ll+.8*(hh-ll),ll+.2*(hh-ll));
plot93(plotfac*cc,"p93");
plot94(plotfac*hh,"p94");
plot95(plotfac*ll,"p95");
If appstorage["rdoCandlesticks.checked"] astype bool then begin
plot91(plotfac*cc,"p91",oo_iff(cc>cc[1],green,red),default,candlewid);
plot92(plotfac*cc[1],"p92");
end;

If False then begin
vcc.insert(0,cc);

var: avgbb2(0);
If chkCalcCycleCyan.checked then avgbb2 = freqCyan
else If chkCalcCycleOrange.checked then avgbb2 = freqOrange
else If chkCalcCycleBlue.checked then avgbb2 = freqBlue
else If chkCalcCycleGold.checked then avgbb2 = freqGold
else If chkCalcCyclePink.checked then avgbb2 = freqPink
Else avgbb2 = 1;
If vcc.count > avgbb2*9 then begin
//print("vcc.count; ",vcc.count:5:0);
//plot41(oo_hma(vcc,50),"p41",white,default,3);
plot41(plotfac*average(vcc,3*avgbb2),"p41",white,default,3);
plot42(plotfac*average(vcc,9*avgbb2),"p42",white,default,3);
end;
end;

var: Pinkdir(0), hhPink(0), vhhPink(0), llPink(0), vllPink(0);
Pinkdir = oo_iff(cyclePink>cyclePink[1],1,-1);
Switch Pinkdir begin
Case 1: If Pinkdir <> Pinkdir[1] then begin vllPink = llPink; hhPink = hh; end;
If vhhPink < hh then vhhPink = hh; If vllPink > ll then vllPink = ll;
Case -1: If Pinkdir <> Pinkdir[1] then begin vhhPink = hhPink; llPink = ll; end;
If vhhPink < hh then vhhPink = hh; If vllPink > ll then vllPink = ll;
end;
If llPink > ll then llPink = ll; If hhPink < hh then hhPink = hh;

var: Golddir(0), hhGold(0), vhhGold(0), llGold(0), vllGold(0);
Golddir = oo_iff(cycleGold>cycleGold[1],1,-1);
Switch Golddir begin
Case 1: If Golddir <> Golddir[1] then begin vllGold = llGold; hhGold = hh; end;
If vhhGold < hh then vhhGold = hh; If vllGold > ll then vllGold = ll;
Case -1: If Golddir <> Golddir[1] then begin vhhGold = hhGold; llGold = ll; end;
If vhhGold < hh then vhhGold = hh; If vllGold > ll then vllGold = ll;
end;
If llGold > ll then llGold = ll; If hhGold < hh then hhGold = hh;

var: bluedir(0), hhBlue(0), vhhBlue(0), llBlue(0), vllBlue(0);
bluedir = oo_iff(cycleBlue>cycleBlue[1],1,-1);
Switch bluedir begin
Case 1: If bluedir <> bluedir[1] then begin vllBlue = llBlue; hhBlue = hh; end;
If vhhBlue < hh then vhhBlue = hh; If vllBlue > ll then vllBlue = ll;
Case -1: If bluedir <> bluedir[1] then begin vhhBlue = hhBlue; llBlue = ll; end;
If vhhBlue < hh then vhhBlue = hh; If vllBlue > ll then vllBlue = ll;
end;
If llBlue > ll then llBlue = ll; If hhBlue < hh then hhBlue = hh;

var: Orangedir(0), hhOrange(0), vhhOrange(0), llOrange(0), vllOrange(0);
Orangedir = oo_iff(cycleOrange>cycleOrange[1],1,-1);
Switch Orangedir begin
Case 1: If Orangedir <> Orangedir[1] then begin vllOrange = llOrange; hhOrange = hh; end;
If vhhOrange < hh then vhhOrange = hh; If vllOrange > ll then vllOrange = ll;
Case -1: If Orangedir <> Orangedir[1] then begin vhhOrange = hhOrange; llOrange = ll; end;
If vhhOrange < hh then vhhOrange = hh; If vllOrange > ll then vllOrange = ll;
end;
If llOrange > ll then llOrange = ll; If hhOrange < hh then hhOrange = hh;

var: Cyandir(0), hhCyan(0), vhhCyan(0), llCyan(0), vllCyan(0);
Cyandir = oo_iff(cycleCyan>cycleCyan[1],1,-1);
Switch Cyandir begin
Case 1: If Cyandir <> Cyandir[1] then begin vllCyan = llCyan; hhCyan = hh; end;
If vhhCyan < hh then vhhCyan = hh; If vllCyan > ll then vllCyan = ll;
Case -1: If Cyandir <> Cyandir[1] then begin vhhCyan = hhCyan; llCyan = ll; end;
If vhhCyan < hh then vhhCyan = hh; If vllCyan > ll then vllCyan = ll;
end;
If llCyan > ll then llCyan = ll; If hhCyan < hh then hhCyan = hh;
end;
If chkShoHHLLPink.checked then begin
plot69(plotfac*vhhPink,"p69",Pink);
plot68(plotfac*vllPink,"p68",Pink);
end;
If chkShoHHLLGold.checked then begin
plot67(plotfac*vhhGold,"p67",Gold);
plot66(plotfac*vllGold,"p66",Gold);
end;
If chkShoHHLLBlue.checked then begin
plot65(plotfac*vhhBlue,"p65",skyblue);
plot64(plotfac*vllBlue,"p64",skyblue);
end;
If chkShoHHLLOrange.checked then begin
plot63(plotfac*vhhOrange,"p63",Orange);
plot62(plotfac*vllOrange,"p62",Orange);
end;
If chkShoHHLLCyan.checked then begin
plot61(plotfac*vhhCyan,"p61",Cyan);
plot60(plotfac*vllCyan,"p60",Cyan);
end;
end;

Plot96(c,"p96",black,default,2);
Plot97(h,"p97",black,default,0);
Plot98(l,"p98",black,default,0);

If False then begin
plot97(1.25*(ampPink+ampGold+ampBlue+ampOrange+ampCyan),"p97",black,default,cyclewid);
plot98(-1.25*(ampPink+ampGold+ampBlue+ampOrange+ampCyan),"p98",black,default,cyclewid);
end;
end;

Once Begin
If chkShoCyclePink.Checked then freq = 1;
If chkShoCycleGold.Checked then freq = 2;
If chkShoCycleBlue.Checked then freq = 4;
If chkShoCycleOrange.Checked then freq = 8;
If chkShoCycleCyan.Checked then freq = 16;

If not chkCalcCyclePink.Checked then ampPink = 0;
If not chkCalcCycleGold.Checked then ampGold = 0;
If not chkCalcCycleBlue.Checked then ampBlue = 0;
If not chkCalcCycleOrange.Checked then ampOrange = 0;
If not chkCalcCycleCyan.Checked then ampCyan = 0;
end;



thank you in advance

Attached Files
Elite Membership required to download: FUN WITH CYCLES.ELD
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
Cheap historycal L1 data for stocks
Stocks and ETFs
ZombieSqueeze
Platforms and Indicators
 
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


tsxela,

you can't really convert it as it uses functionality that is not available in Multicharts like forms for example). It also appears that a huge part of the code is missing - which is likely to be the designer generated code. While you could strap away everything that MC doesn't support, it's quite likely that the end result would be very limited and therefore I am not sure if it would be worth the effort.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on March 29, 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