trading

Tradingview Pine script `strategy.exit` and `strategy.close` don't respect `from_entry` value

怎甘沉沦 提交于 2021-02-11 15:17:58
问题 I have several different entries in my strategy, and I want to assign separate stop losses to them: // @version=4 strategy("Test strategy") strategy.entry("E0", strategy.long, limit=10000, when=close[1] > 10000) strategy.entry("E1", strategy.long, limit=10000, when=close[1] > 10000) strategy.exit("SL-E0", "E0", stop=9000) strategy.exit("SL-E1", "E1", stop=9500) As far as I understand the documentation (https://www.tradingview.com/pine-script-reference/#fun_strategy{dot}exit) the 2nd parameter

Pinescript conditional statement plotting

那年仲夏 提交于 2021-02-11 12:13:15
问题 I'm trying to create a plot to the chart based on the following conditions: It's the second consecutive green bar to open above the 9 day MA line It's oversold on the RSI I'm having issue is what order to write the condition, and knowing how many brackets I need? strategy(title="Swing Strat", pyramiding=1, overlay=true, default_qty_value=2, default_qty_type=strategy.fixed, initial_capital=100, currency=currency.GBP) //plotting MA lines MAPeriod9 = input(9, title="9 MA Period") MA9 = sma(close

how to use correctly if statement postgresql

南笙酒味 提交于 2021-02-11 05:58:39
问题 I'm trying to create a trigger that populates a table everytime X amount of rows are added to other table. The logic would be: 1- check how many rows are in table A based on last date on table B. 2- once there are 1000 rows in table A from the last date on table B, add one row to table B Table A stores ticks from market and table B stores OHLC data (Open, High, Low, Close). Ticks have only 3 columns: date, bid and ask. Open is the first known price, Low is the min price, High is the max price

how to use correctly if statement postgresql

﹥>﹥吖頭↗ 提交于 2021-02-11 05:58:35
问题 I'm trying to create a trigger that populates a table everytime X amount of rows are added to other table. The logic would be: 1- check how many rows are in table A based on last date on table B. 2- once there are 1000 rows in table A from the last date on table B, add one row to table B Table A stores ticks from market and table B stores OHLC data (Open, High, Low, Close). Ticks have only 3 columns: date, bid and ask. Open is the first known price, Low is the min price, High is the max price

What is the correct way to define MQL4 “#import of static class methods”?

 ̄綄美尐妖づ 提交于 2021-02-08 02:16:31
问题 What I'm trying to achieve is define classes (using MQL4 ) in separate files and use the methods from those classes in the main code. Essentially importing static class member functions. class example{ // ____ in example.mq4 public: static void myfunction(void) export { .. do something .. } } class example{ // ____ in example.mqh public: static void myfunction(void); } #include <example.mqh> // ____ in main.mq4: #import "example.ex4" void example::myfunction(void); #import Results in a

What is the correct way to define MQL4 “#import of static class methods”?

蹲街弑〆低调 提交于 2021-02-08 02:15:59
问题 What I'm trying to achieve is define classes (using MQL4 ) in separate files and use the methods from those classes in the main code. Essentially importing static class member functions. class example{ // ____ in example.mq4 public: static void myfunction(void) export { .. do something .. } } class example{ // ____ in example.mqh public: static void myfunction(void); } #include <example.mqh> // ____ in main.mq4: #import "example.ex4" void example::myfunction(void); #import Results in a

What is the correct way to define MQL4 “#import of static class methods”?

↘锁芯ラ 提交于 2021-02-08 02:15:29
问题 What I'm trying to achieve is define classes (using MQL4 ) in separate files and use the methods from those classes in the main code. Essentially importing static class member functions. class example{ // ____ in example.mq4 public: static void myfunction(void) export { .. do something .. } } class example{ // ____ in example.mqh public: static void myfunction(void); } #include <example.mqh> // ____ in main.mq4: #import "example.ex4" void example::myfunction(void); #import Results in a

What is the correct way to define MQL4 “#import of static class methods”?

佐手、 提交于 2021-02-08 02:14:43
问题 What I'm trying to achieve is define classes (using MQL4 ) in separate files and use the methods from those classes in the main code. Essentially importing static class member functions. class example{ // ____ in example.mq4 public: static void myfunction(void) export { .. do something .. } } class example{ // ____ in example.mqh public: static void myfunction(void); } #include <example.mqh> // ____ in main.mq4: #import "example.ex4" void example::myfunction(void); #import Results in a

“alertcondition” fails when the condition comes from a security function

萝らか妹 提交于 2021-02-05 11:12:31
问题 I'm trying to create alerts based on conditions that derive from security functions. Below, the relevant piece of the code, and here is the entire code. s01 = input('BINANCE:BTCUSDT', type=input.symbol) screenerFunc() => triggerA and triggerB c01 = security(s01, res, screenerFunc()) alertcondition(condition=c01, title="Alert", message="Alert!") But I'm getting the following error for the last line: Cannot use a mutable variable as an argument of the security function. Appreciate the help! 回答1

How to detect if in ANY candle in the past 'n' candles meet a certain requirement?

人盡茶涼 提交于 2021-01-29 20:01:36
问题 I'd like to check if ANY candle in the past 'n' candles meet a certain condition. E.g. let's check if any close in the latest 20 candles was higher than 'x': x = 2 n = 20 condition = [ANY of n] > x 回答1: See barssince() and an example showing how to use it here. You can also count the number of occurrences of a condition in the last n bars using: sum(cond ? 1 : 0, len) Disclosure : the link in this answer points to a PineCoders FAQ entry. I am a member of the PineCoders community and I most