What is the difference between inBuy[1] and inBuy in the end of these two sentence? - pine-script-v5

inBuy := not inBuy[1] and close < l1Long[1] ? true : inBuy[1]
inBuy := inBuy[1] and close > stopPrice ? false : inBuy
I know that the inBuy[1] statement is in the state of calling the value of inBuy in previous the bar,but what does inBuy mean without []?

I'm not sure what value "inBuy" represents but I can tell you the difference between the two.
ibuy alone refers to the value of the current bar. (right most on chart)
inBuy[0] is identical to inBuy alone, without sequence reference (as above)
inBuy[1] refers to 1 bar ago from the current bar.
inBuy[2] refers to 2 bars ago from the current bar.
Etc, etc.

Related

Why would a white space change the meaning of a sentence in auto hotkey?

Recently I noticed a problem that it seems when I call a function with a white space included, the function call won't work correctly.Example:
while true
{
tooltip, % getkeystate ("lbutton","p")
;tooltip, % getkeystate("lbutton","p")
}
return
the code commented works correctly showing 1 or 0 ,but the former one always shows "lbutton", which confused me a lot, I wonder:
1.What causes the difference?
2.What is the syntax of the former one?Why would it return the key name?
3.When would a white space affect the meaning of a sentence?
It is because in the first one, the tooltip evaluates the expression which in this case starts with the empty variable getkeystate and then returns the quoted string lbutton so that is what the tootltip shows.
The second one evaluates a function getkeystate(parameters) to put in the tooltip.

VS code snippets - what is the required number in front of a choice list?

https://code.visualstudio.com/docs/editor/userdefinedsnippets#_choice
${1|one,two,three|}
So I'm new to snippets, and I noticed the number in front of a list of completion choices is required to show the choice menu correctly (if omitted, it will populate the choice list as a literal string - https://github.com/infosec-intern/textmate-yara/pull/29).
What does this number do, and why is it needed ?
(the documentation doesn't explain it)
is it for the default selection ?
Thanks,
In ${1|one,two,three|} the 1 is a tabstop. When you trigger the snippet that is the first place your cursor will go. See https://code.visualstudio.com/docs/editor/userdefinedsnippets#_tabstops
Tabstops
With tabstops, you can make the editor cursor move inside a snippet.
Use $1, $2 to specify cursor locations. The number is the order in
which tabstops will be visited, whereas $0 denotes the final cursor
position. Multiple occurrences of the same tabstop are linked and
updated in sync.
Accorsing to the snippet grammar the tabstop number is required before a choice element.
choice ::= '${' int '|' text (',' text)* '|}'
Since it is a choice element it makes sense that you want the cursor to go there at some time just by cycling through the tabstops with the tab key. You can select the order of the tabstops, they don't have to be in any certain order within your snippet. Tabstop $2 could appear before $1 for example.
And the tabstop has nothing to do with the default selection/option. The default will always be the first option listed in the snippet.

Setting the chart cursor to change at the start of the next value

I'm having this problem with my graphs, I'm searching for the option that doesn't make the bullet jump to the second value when going a little by the middle.
I think the problem is that I'm using two dates only, But I want the value only to change just before the 07, and not when passing the middle.
2014-03-01 5
2014-03-07 8
Left side
Right side
I need to find an option that makes the bullet change the value only when next to the new value and date. I tried a lot of settings in the creator but couldn't find anything.
Ideas?

IF statement with Condtional Formating Crystal

I want to do an IF statement that has 2 outcomes:
I want it to say a word
I want it to be a color
For example:
IF {Command.Check in/Appt} < 0
THEN "Early" AND crGreen
ELSE "LATE" AND crRed
In the above example the AND does not work.
A Boolean is required here.
So I just need to find a way to have those 2 outcomes
Short of using shared variables, you can't do that. One formula, one output.
But there's nothing saying you can't have two nearly identical formulas, (One for Early/Late, one for Red/Green) - And in Crystal, that's the best way to do it. (Glad to see you figured that out on your own.)
The reason the AND keyword was giving you trouble is because AND is a Boolean operator. Whenever you use AND, you're basically using this function:
Take booleans FOO and BAR as input.
I return true if, and only if, FOO and BAR are both true.
If at least one of them is false, I return false.
So the AND keyword was expecting two booleans for input. Instead you gave it a string and a color. Ask a machine if the color Red is equal to true, it's going to complain.
Ok, while I didn't find a solution by adding it in the formula, I did find a solution.
For those who have the same problem, just keep the IF statement:
IF {Command.Check in/Appt} < 0
THEN "Early"
ELSE "LATE"
Then save and go to Format > Highlight Expert to enter the formatting conditions you like.
In the above case, I did:
New > Value of: this field is equal to "Early" Font color Green
New > Value of: this field is equal to "Late" Font color Red

How do I set two different words to be equal in beyond compare 3

I'm trying to diff different versions of a program. The older version uses 1 and 0 to represent true and false while the new version uses the words true and false. Since these boolean values are everywhere, most of the file is 'different.' For now I've added 1,0,false,and true to unimportant in a custom file type, but this has a few unfortunate side effects (like not matching a 1 that changed to false.) So, does anyone know how to make true match to 1 and false to 0?
edit:
The language is a proprietary one for my company, but it's relatable to sql. An example of what I mean would be
select *
from fake_table ft
where ft.active_ind = 1
becomes
select *
from fake_table ft
where ft.active_ind = true
If you have a Beyond Compare 3 or 4 Pro license, you can use Replacements in the Text Compare to show the differences as a match. Replacements are a pro only feature, if you have a BC3 or BC4 Standard license, then you'll have to use unimportant text.
In the Text Compare, click the Rules toolbar button (referee icon).
Go to the Replacements tab. Click New (BC3) or + (BC4).
Text to find: 1
Replace with: True
After you define the replacements, 1 on the left matched with True on the right will be colored as a match if View > Ignore Unimportant Differences is on.