How do I restart this countdown in Rainmeter? - rainmeter

I'm trying to build a very simple countdown that restarts once it reaches 0. Why isn't the code on Line 15 (IfBelowAction) working? What would be an alternative method to accomplish this?
[Rainmeter]
Update=1000
DynamicWindowSize=1
[Metadata]
Name=Test
Author=jjnnugent
Information=Test skin.
Version=1.0.0
[MeasureMeter]
Measure=Calc
Formula=10
IfBelowValue = 0
IfBelowAction=[!SetOption MeasureMeter Formula "10"]
OnUpdateAction=[!SetOption MeasureMeter Formula "MeasureMeter - 1"]
[MeasureString]
Meter=String
MeasureName=MeasureMeter
FontSize=18
FontColor=255,255,255
SolidColor=50,50,50,175
StringStyle=Bold
AntiAlias=1
Text=Seconds left %1

[MeasureMeter]
Measure=Calc
Formula=(MeasureMeter-1+(10+1))%(10+1)
Found the answer covered in their documentation under Bonus Lesson:
https://docs.rainmeter.net/tips/counters-guide/

Related

How to make "less than" function in Prolog?

As i am new to Prolog i made this program but having a lot of troubles can anyone help me?
below is my code:
android(samsung,s10,brown,90000).
android(huwawei,mate10lite,black,34000).
android(oppo,f9,blue,20000).
featured(nokia,1110,brown,10000).
featured(qmobile,q3,black,24000).
featured(gfive,g300,blue,30000).
amount(X,Y,Z,A):-
android(X,Y,Z,A),
A > 25000,
featured(X,Y,Z,A),
A>25000.
fun:-
amount(X,Y,Z,A),
writef("cellphone having less than 25K is",[X],[Y],[Z],[A]),
fail.
i don't know what is the issue if anyone can help please help me out.
when ever i am calling fun it's returning false.
Evidently,
amount(X,Y,Z,A):-
android(X,Y,Z,A), <---+
A > 25000, +--- exactly as for X,Y,Z, this is the SAME A
featured(X,Y,Z,A), <---+
A>25000. <------- ... so you've already tested this!
you really want to have a B:
amount(X,Y,Z,A):-
android(X,Y,Z,A),
A > 25000,
featured(X,Y,Z,B),
B =< 25000.
And why do you fail. at the end of fun? That doesn't sound like fun at all!

undefined procedure on ECLiPSe 7.0 Prolog

I have the next .ecl file:
:-lib(ic).
test(Valparaiso, Olmue):-
Valparaiso :: 1..10,
Olmue :: 1..10,
2*Valparaiso + 1*Olmue #<= 10,
1*Valparaiso + 2*Olmue #<= 8,
labeling(Valparaiso),
labeling(Olmue).
So I get the next error:
calling an undefined procedure 2 * A + 1 * B #<= 10 in module eclipse
I use ECLiPSe 7.0 for run that script.
That's something Prolog/ECLiPSe beginners occasionally stumble over: The "less-equal" sign is =<, not <= as in many other languages. Best remembered by visualizing the shape of the operator:
It's actually more beautiful, isn't it? As to why it was done this way, folklore says that one wanted to reserve the <= as a left arrow or reverse implication symbol.

Pinescript duplicate alerts

I have created a very basic script in pinescript.
study(title='Renko Strat w/ Alerts', shorttitle='S_EURUSD_5_[MakisMooz]', overlay=true)
rc = close
buy_entry = rc[0] > rc[2]
sell_entry = rc[0] < rc[2]
alertcondition(buy_entry, title='BUY')
alertcondition(sell_entry, title='SELL')
plot(buy_entry/10)
The problem is that I get a lot of duplicate alerts. I want to edit this script so that I only get a 'Buy' alert when the previous alert was a 'Sell' alert and visa versa. It seems like such a simple problem, but I have a hard time finding good sources to learn pinescript. So, any help would be appreciated. :)
One way to solve duplicate alters within the candle is by using "Once Per Bar Close" alert. But for alternative alerts (Buy - Sell) you have to code it with different logic.
I Suggest to use Version 3 (version shown above the study line) than version 1 and 2 and you can accomplish the result by using this logic:
buy_entry = 0.0
sell_entry = 0.0
buy_entry := rc[0] > rc[2] and sell_entry[1] == 0? 2.0 : sell_entry[1] > 0 ? 0.0 : buy_entry[1]
sell_entry := rc[0] < rc[2] and buy_entry[1] == 0 ? 2.0 : buy_entry[1] > 0 ? 0.0 : sell_entry[1]
alertcondition(crossover(buy_entry ,1) , title='BUY' )
alertcondition(crossover(sell_entry ,1), title='SELL')
You'll have to do it this way
if("Your buy condition here")
strategy.entry("Buy Alert",true,1)
if("Your sell condition here")
strategy.entry("Sell Alert",false,1)
This is a very basic form of it but it works.
You were getting duplicate alerts because the conditions were fulfulling more often. But with strategy.entry(), this won't happen
When the sell is triggered, as per paper trading, the quantity sold will be double (one to cut the long position and one to create a short position)
PS :You will have to add code to create alerts and enter this not in study() but strategy()
The simplest solution to this problem is to use the built-in crossover and crossunder functions.
They consider the entire series of in-this-case close values, only returning true the moment they cross rather than every single time a close is lower than the close two candles ago.
//#version=5
indicator(title='Renko Strat w/ Alerts', shorttitle='S_EURUSD_5_[MakisMooz]', overlay=true)
c = close
bool buy_entry = false
bool sell_entry = false
if ta.crossover(c[1], c[3])
buy_entry := true
alert('BUY')
if ta.crossunder(c[1], c[3])
sell_entry := true
alert('SELL')
plotchar(buy_entry, title='BUY', char='B', location=location.belowbar, color=color.green, offset=-1)
plotchar(sell_entry, title='SELL', char='S', location=location.abovebar, color=color.red, offset=-1)
It's important to note why I have changed to the indices to 1 and 3 with an offset of -1 in the plotchar function. This will give the exact same signals as 0 and 2 with no offset.
The difference is that you will only see the character print on the chart when the candle actually closes rather than watch it flicker on and off the chart as the close price of the incomplete candle moves.

SPSS: Syntax for Calculating FSCORE from rotated factors

I found the proper syntax to import my centriod factor extraction into SPSS and rotate it. (The semi-bumbling tale is here.
The next issue is this: because of limitations in SPSS on what subcommands can be used when reading a matrix in (only /ROTATE and /EXTRACTION are permitted), I can't get the factor scores. SPSS displays this error:
"Factor scores cannot be computed with matrix input."
I still need to find a way to get the FSCORE of the newly rotated factors of each factor for all cases by running a regression using the newly rotated factors and saving the regression values as a new variable (/SAVE REG(ALL).
Ideas are welcome. Thank you for your expertise!
Assets: Dataset A of 36 cases and 74 variables (the basis of the centriod factor extraction); centriod factor extraction matrix
Here's the SPSS syntax that almost does what I need - except it uses PCA extraction instead of centroid.
FACTOR
/VARIABLES VAR00001 VAR00002 VAR00003 VAR00004 VAR00005 VAR00006 VAR00007 VAR00008 VAR00009 VAR00010 VAR00011 VAR00012 VAR00013 VAR00014 VAR00015 VAR00016 VAR00017 VAR00018 VAR00019 VAR00020 VAR00021 VAR00022 VAR00023 VAR00024 VAR00025 VAR00026 VAR00027 VAR00028 VAR00029 VAR00030 VAR00031 VAR00032 VAR00033 VAR00034 VAR00035 VAR00036 VAR00037 VAR00038 VAR00039 VAR00040 VAR00041 VAR00042 VAR00043 VAR00044 VAR00045 VAR00046 VAR00047 VAR00048 VAR00049 VAR00050 VAR00051 VAR00052 VAR00053 VAR00054 VAR00055 VAR00056 VAR00057 VAR00058 VAR00059 VAR00060 VAR00061 VAR00062 VAR00063 VAR00064 VAR00065 VAR00066 VAR00067 VAR00068 VAR00069 VAR00070 VAR00071 VAR00072 VAR00073 VAR00074
/MISSING LISTWISE
/ANALYSIS VAR00001 VAR00002 VAR00003 VAR00004 VAR00005 VAR00006 VAR00007 VAR00008 VAR00009 VAR00010 VAR00011 VAR00012 VAR00013 VAR00014 VAR00015 VAR00016 VAR00017 VAR00018 VAR00019 VAR00020 VAR00021 VAR00022 VAR00023 VAR00024 VAR00025 VAR00026 VAR00027 VAR00028 VAR00029 VAR00030 VAR00031 VAR00032 VAR00033 VAR00034 VAR00035 VAR00036 VAR00037 VAR00038 VAR00039 VAR00040 VAR00041 VAR00042 VAR00043 VAR00044 VAR00045 VAR00046 VAR00047 VAR00048 VAR00049 VAR00050 VAR00051 VAR00052 VAR00053 VAR00054 VAR00055 VAR00056 VAR00057 VAR00058 VAR00059 VAR00060 VAR00061 VAR00062 VAR00063 VAR00064 VAR00065 VAR00066 VAR00067 VAR00068 VAR00069 VAR00070 VAR00071 VAR00072 VAR00073 VAR00074
/PRINT INITIAL CORRELATION SIG DET INV REPR AIC EXTRACTION ROTATION FSCORE
/FORMAT BLANK(.544)
/CRITERIA FACTORS(6) ITERATE(80)
/EXTRACTION PC <---Here's the rub.
/CRITERIA ITERATE(80) DELTA(0)
/ROTATION OBLIMIN
/SAVE REG(ALL)
/METHOD=CORRELATION.
I referred to the MATRIX command in my reply to your other post (Rotations). You will need to research the appropriate equations for performing this calculation and set up the matrix algebra within a MATRIX END - MATRIX code block. Easy once you have the math right. I'm too busy/lazy to research and write it but this should provide a fertile lead.

Smoothing measured data in MATLAB?

I have measured data from MATLAB and I'm wondering how to best smooth the data?
Example data (1st colum=x-data / second-colum=y-data):
33400 209.11
34066 210.07
34732 212.3
35398 214.07
36064 215.61
36730 216.95
37396 218.27
38062 219.52
38728 220.11
39394 221.13
40060 221.4
40726 222.5
41392 222.16
42058 223.29
42724 222.77
43390 223.97
44056 224.42
44722 225.4
45388 225.32
46054 225.98
46720 226.7
47386 226.53
48052 226.61
48718 227.43
49384 227.84
50050 228.41
50716 228.57
51382 228.92
52048 229.67
52714 230.02
53380 229.54
54046 231.19
54712 231.00
55378 231.5
56044 231.5
56710 231.79
57376 232.26
58042 233.12
58708 232.65
59374 233.51
60040 234.16
60706 234.21
The data in the second column should be monoton but it isn't. How to make it smooth?
I could probably invent a short algorithm myself but I think it's a better way to use an established and proven one... do you know a good way to somehow integrate the outliners to make it a monoton curve!?
Thanks in advance
Monotone in your case is always increasing!
See the options below (1. Cobb-Douglas; 2. Quadratic; 3. Cubic)
clear all
close all
load needSmooth.dat % Your data
x=needSmooth(:,1);
y=needSmooth(:,2);
n=length(x);
% Figure 1
logX=log(x);
logY=log(y);
Y=logY;
X=[ones(n,1),logX];
B=regress(Y,X);
a=exp(B(1,1));
b=B(2,1);
figure(1)
plot(x,y,'k*')
hold
for i=1:n-1
plot([x(i,1);x(i+1,1)],[a*x(i,1)^b;a*x(i+1,1)^b],'k-')
end
%Figure 2
X=[ones(n,1),x,x.*x];
Y=y;
B=regress(Y,X);
c=B(1,1);
b=B(2,1);
a=B(3,1);
figure(2)
plot(x,y,'k*')
hold
for i=1:n-1
plot([x(i,1);x(i+1,1)],[c+b*x(i,1)+a*x(i,1)^2; c+b*x(i+1,1)+a*x(i+1,1)^2],'k-')
end
%Figure 3
X=[ones(n,1),x,x.*x,x.*x.*x];
Y=y;
B=regress(Y,X);
d=B(1,1);
c=B(2,1);
b=B(3,1);
a=B(4,1);
figure(3)
plot(x,y,'k*')
hold
for i=1:n-1
plot([x(i,1);x(i+1,1)],[d+c*x(i,1)+b*x(i,1)^2+a*x(i,1)^3; d+c*x(i+1,1)+b*x(i+1,1)^2+a*x(i+1,1)^3],'k-')
end
There are also some cooked functions in Matlab such as "smooth" and "spline" that should also work in your case since your data is almost monotone.

Resources