How to Set alert in Trading view for the indicator ' RSI Divergences' - rsi

How to Set alert in Trading view for the indicator ' RSI Divergences'
Creator Name- domenicosilletti
I Need alert for only Regular Divergence BULL/BAR

Related

Pinescript: Enter position when multiple conditions are met but one is bool type and other is float

I am fairly new and can sure use your kind help.
Trying to validate a standard MACD crossover to generate a buy signal ONLY IF the following average directional movement function (which can show only 0 or 1 values), displays in the previous trading day a "1" value.
//ADX Oscillator
[di_pos, di_neg, adx] = ta.dmi(14, 14)
SellLong = ta.change(adx) > 0 ? true : false
Idea is to validate the MACD crossover (buy signal) only if it happens after a "strong" selloff, highlighted by high ADX. My problem is that strategy execution condition (as follows) returns exception for comparing float with bool type data.
if ta.crossover(delta, 0) and SellLong [1]=1
strategy.entry ()
Thanks a lot
A

Design a custom year view with 12 month slots

Sample View:
I would like to create a custom year view to show the timeline in every month slots. I can use fullcalendar-scheduler with a custom view and define like this:
views: {
timelineCustom: {
type: 'timeline',
buttonText: 'Year View',
duration: {year:1},
slotDuration: {month:1}
}
}
However, there is no way to set up a fiscal year view with month start at April 1st and end at March 31st next year. And also, a timeline bar will cover a whole month slot even though an event only starts from the second half of that month.
Your first problem - starting the view in April and ending in March of the following year, can be solved using the new "visibleRange" option. This lets you supply start/end dates for the view, relative to the "currentDate" (i.e. the date fullCalendar curently regards as being selected). You also have to set the "dateIncrement" option, to ensure that Next/Previous increment the current date by 1 year.
N.B. This requires fullCalendar 3.3.0 and Scheduler 1.6.0, or later.
timelineCustom: {
type: 'timeline',
buttonText: 'Year View',
dateIncrement: { years: 1 },
slotDuration: { months: 1 },
visibleRange: function(currentDate) {
return {
start: currentDate.clone().startOf('year').add({ months: 3}),
end: currentDate.clone().endOf("year").add({ months: 4})
};
}
}
See https://fullcalendar.io/docs/current_date/visibleRange/ and https://fullcalendar.io/docs/current_date/dateIncrement/ for more details
However, your issue where the timeline bar covers a whole month slot even though an event only starts in the second half of a month, is not really solvable in the way you want. The whole point of "slots" is to be the minimum time that an event can be displayed for in that particular view. If you want it to be more subtle than that, you would have to define shorter slots. The same thing happens in fullCalendar's default "Month" (non-timeline) view - all events cover a whole day even if they're timed, but you can see the times in the description. I see in your example you have already got the dates of those events displayed in the description, so it should be reasonably clear for your users.
I suggest your users click on the Month View to get a more detailed breakdown with the slot durations more accurately displayed. Either that or you have to compromise and set slotDuration to something smaller.

Scilab: How to use cbmenu in xclick()

I do not understand the explanation of the output argument cbmenu in the Scilab documentation of xclick.
It says:
cbmenu: String: callback associated to a menu if xclick returns due to a click on a menu.
I did not find any example in the web so I ask here. I have coded a snippet which lumps together the elements which may be relevant for cbmenu. The snippet does nothing, when I click on CLICK. Could anyone alter/complement/revise the code so that it does something - whatever it is to give me a clue what could be done with cbmenu?
xdel()
x=[-1 +1];
cf=figure(0);
plot(x,x)
m=uimenu(cf,'label','CLICK','callback','two=1+1');
[ibutton,xcoord,yxcoord,iwin,cbmenu]=xclick();
Kind regards
Rosestock
This is a minimal script which explains what the 5th output argument of xclick() can do:
xdel()
x=[-1 +1];
winnum=1; win=string(winnum);
cf=figure(winnum);
plot(x,x)
C=["Green" "Red" "Abort"];//case name strings
addmenu(winnum, C(1)); C1="execstr("+C(1)+"_"+win+"(1))";
addmenu(winnum, C(2)); C2="execstr("+C(2)+"_"+win+"(1))";
addmenu(winnum, C(3)); C3="execstr("+C(3)+"_"+win+"(1))";
while %t
[!,!,!,!,cbmenu]=xclick();
//Get the clicked option by cbmenu
if cbmenu==C1, cf.background=3; end
if cbmenu==C2, cf.background=5; end
if cbmenu==C3, break, end
end
If I get your intentions right, you want to create a custom menu. Here is a small demo, how to bulid custom menu elements, and also how to use locate to get back coordinates (but you don't need xclick to sense menu clicking). This code does not use explicitly cbmenu, but it is not necessary to get it work. If you run the code, first click the "Select range" menu, then click two times on the graph. Then the "Regression" menu is activated, and you can choose "Linear regession". By clicking "Exit program", the execution aborts. Not all nenu functions are implemented, they are there only to demonstrate a multilayer structure. I hope it helps!
//Interactive menu demo
// Scilab 5.5.2
// 2016.12.20. Attila Eredics
//
//Attention!
//Do not close the graphic window with the original x symbol
// while the program is running,
// because the program will run infinitely!
// But you can stop it in the Consol with: Ctrl+C and then typing: abort
clc;
clear;
lines(0);
//artificial data vectors
row = 100;
t=gsort(rand(row,1),'r','i'); //time
c=10*t+8; //concentration
c=c+rand(c); //add some noise
//graphic window
scf(0); clf(0);
w=gcf(); //get current figure
//new menu elements
m3=uimenu(w,"Label","Select range","Callback","m=3");
m4=uimenu(w,"Label","Regression","Enable","off","ForegroundColor","0.5|0.5|0.5");
m41=uimenu(m4,"Label","Linear","Callback","m=41","Enable","on");
m42=uimenu(m4,"Label","Nonlinear","Callback","m=42","Enable","on");
m5=uimenu(w,"Label","Save results","Callback","m=5");
m6=uimenu(w,"Label","Exit program","Callback","abort","ForegroundColor","1|0|0");
plot2d(t,c,style=-5,frameflag=6); //plot the data
xtitle("","time","concentration"); //axis labels
while %T //infinite loop
//-------------wait for user action (click on a menu)-------
m=0;
while m<1
xpause(1e4); //pause 10ms
end
//------------------the menu actions-------------------------
if m==3 then //Select range
mprintf("\nChoose 2 points (click on the graph)!");
coord=locate(2); //locate two clicks
disp(coord); //coord: according to the axes
//Select range in t vector
for i=1:row-1
if coord(1,1)>=t(i) & coord(1,1)<t(i+1) then //t(i) <= 1st click < t(i+1)
i1=i;
end
if coord(1,2)>=t(i) & coord(1,2)<t(i+1) then //t(i) <= 2nd click < t(i+1)
i2=i;
end
end
//selected range
clear tt;
clear cc;
tt=t(i1:i2);
cc=c(i1:i2);
plot2d(tt,cc,style=-5); //plot selected points
h2=gce();
h2.children.mark_foreground=3; //green
m4.Enable="on"; //enable Regression menu
m4.ForegroundColor="0|0|0"
m3.Enable="off"; //Disable selection menu
m3.ForegroundColor="0.5|0.5|0.5"
elseif m==41 then //linear regression of the selected points
mprintf("\nLinear regression");
[a,b,sig]=reglin(tt',cc');
plot2d([tt(1),tt($)],a*[tt(1),tt($)]+b,style=2); //blue line
m41.Enable="off"; //disable Linear regression menu
m41.ForegroundColor="0.5|0.5|0.5"
elseif m==42 then //Nonlinear regression
mprintf("\nNot implemented yet!");
elseif m==5 then //Save
mprintf("\nNot implemented yet!");
end
end

plone.app.event- Using IEventBasic as a behavior, how can I properly set the end field programatically in an event?

I have a dexterity content type (my.product.myobject) that uses the IEventBasic behavior (implemented in the xml file with other behaviors) and I'm trying to make the end field be set within the same week of the start field. I attempt to correct the end date in an IObjectAddedEvent (zope.lifecycleevent.interfaces.IObjectAddedEvent).
I first get the week range from the start field:
def getWeekRangeFromDate(a_date,offset=1):
start = (a_date - timedelta(days=(a_date.weekday() + offset) % 7)).replace(hour=0,minute=0)
end = (start + timedelta(days=6)).replace(hour=23,minute=59)
return {'start':start,
'end':end,
}
def myObjectAdded(myObject, event):
week_range = getWeekRangeFromDate(myObject.start)
if myObject.end > week_range['end']:
myObject.end = week_range['end']
I have the end field printed in the browserview and I use IEventAccessor to extract the end date from the myObject:
class View(BrowserView):
def __init__(self,context,request):
...
self.context = self.context
def getFormattedEnd(self):
if self.context.whole_day == False:
return IEventAccessor(self.context).end.strftime('%m/%d %I:%M %p')
...
When it doesn't need to be programmatically corrected, the end field displays correctly, but when it does, it appears 5 hours off.
In my myObjectAdded event, I tried:
if myObject.end > week_range['end']:
myObject.end = week_range['end'] - timedelta(hours = IEventAccessor(myObject).end.offset().total_seconds()/3600)
This does appear right actually, but when I go to the edit form and change the start field, the end field ends up changing itself seemingly random. Changing the starting hour field to 16 changed the end's month about two weeks ahead.
How can I set it without it acting up? Am I misundertanding how to use IEventBasic?
Edit: I'm coming across something really interesting. In the edit form, the Start End Validator is failing.
Event Starts - 25/November/2016 9:00
Event Ends - 25/Novermber/2016 20:00
I click submit and the status message says End date must be after the start date.
Edit: The version of Plone I am using is 4.3.

'clientEvents' decreases start time automatically

Problem with clientEvents
var tempEventWithOlderInfo = calendar.fullCalendar( 'clientEvents' ,'_fc798' )[0];
alert( 'start time: '+ tempEventWithOlderInfo.start.getHours() );
This alerts the wrong time. If the start time of event is 6:30 PM. The above code would alert 5 instead of 6.
I am not sure why clientEvents method isn't returning the correct time.
No need for a bug report here. getHours() returns the hour of the day as indexed from 0.
The full range of values getHours() can return is 0-23. Just increment your result by 1 to get the actual hour.
http://www.w3schools.com/jsref/jsref_gethours.asp

Resources