Questions tagged [algorithmic-trading]
Algorithmic trading is a technique of trading financial assets through an algorithm which has been fully or partially automated into a computer program.
1,209
questions
0
votes
0
answers
9
views
Is the TradingView alert system refreshed regularly?
Thanks for all your effort.
I found a surprising phenomenon in a alert system.
As you know, repainting indicator applied to a chart is not actually 'repainted' until we refresh the chart. right?
...
0
votes
0
answers
12
views
How do I add a daterange to open trades during when backtesting with backtrader?
I am trying to backtest a strategy where trades are only opened during 8.30 to 16.00 using backtrader.
Using the below attempt my code is running but returning no trades so my clsoing balane is the ...
0
votes
2
answers
23
views
Boolean Take Profits in Pinescript
Im wanting to create a Take Profit parametre that exit a position when a certain condition is met, for example
Long_take_Profit = ta.crossunder(adx, plus)
any solutions on how to turn this condition ...
0
votes
0
answers
18
views
Coinbase API - Using 10 and 20 Day SMA Strategy
I am trying to plot a 10 and 20 day SMA on windows forms app, I have managed to get the candlesticks to render, but I am not sure if my logic to find the indicators for 10 and 20 day SMA is correct.
...
-1
votes
0
answers
11
views
traceback, timestamp and recwindow
I am trying to get account information, specifically my USDT balance to calculate the percentage (%) and I get the following error:
File "c:\Users\hecto\OneDrive\Escritorio\Bot Definitivo\bot.py&...
0
votes
1
answer
18
views
Plot the break of Highrange of a MACD
hello can someone help me plotshape whenever a MACD high is broken like this?
this is my code
//@version=5
indicator("break high", overlay = true)
// === MACD ===
fastMA = input.int(title=&...
0
votes
0
answers
12
views
How to simulate BitMex realised PnL in strategy for backtesting
I want to simulate the realised "profit and loss" (PnL) values of the BitMex exchange in a way that the profit in the "trading view - strategy tester - list of trades"
TV Profit
...
-2
votes
0
answers
31
views
How to create future orders in the testnet with Python and Binance API
I'm developing a trading-futures bot with Python, and I've been trying to create a simulated order in the futures market using the python-binance library, but I've been wondering if there's a way to ...
0
votes
1
answer
61
views
How do I correctly use the the Binance API to execute a trade in my code?
I have created a python trading bot but I cant get the code to execute a trade. Just fyi I am not an experienced coder, and have only worked with computational numerical solutions. I have never used ...
-1
votes
0
answers
43
views
trailing take profit supertrend pine script
I am programming a small strategy in which, apart from the supertrend, I also want a trailing stop los and take profit atr. I am not an expert pine script programmer, but I have this and the trailing ...
-2
votes
1
answer
24
views
How to restart a script from top after a "List assignment index out of range" error. loops for 100+ times and no problems, than stops on this error
it goes true the list and every time deletes on from the list and last one it gets the list back and starts all over again. I am just an amateur that try to run my trading bot.
it's running for few ...
0
votes
1
answer
58
views
using valuewhen in pine script
I can understand how valuewhen works in pine script by its docs at https://www.tradingview.com/pine-script-reference/v5/#fun_ta{dot}valuewhen
The example given there is simple:
// Get value of `close` ...
-1
votes
1
answer
11
views
incorrect values for a Commodity Channel Index Indicator
I'm trying to make a simple CCI indicator but the values are incorrect (see photo).
I don't understand why. Can someone help me?
(https://i.stack.imgur.com/YTAc5.png)
CCI= (.015×Mean Deviation) / (...
0
votes
0
answers
21
views
Pine Script - how to exit on the next bar's open AND have an intrabar stop loss and profit target on entry bar? Max hold 1 + SL/PT
I cannot enter on the opening tick of a bar, have an intrabar stop loss and profit target (achieved by using calc_on_order_fills = true property) and then also exit on the next bar's opening tick (max ...
-2
votes
1
answer
27
views
How to count HL2 source in python Binance trading bot?
:))
I've made a crypto trading bot in python connected to my Binance account. My problem is to count HL2 source ((High+Low)/2). I want to make a sma(hl2, 17) but I can't figure out how to do it. If I ...
0
votes
1
answer
26
views
Creating Moving Average crossover in TradingView Pine Editor
i want to create a pine script in trading view for a moving average crossover between a EMA of length 5 and SMMA (Smoothed Moving Average) of length 7
I was able to create for the 5 EMA but couldnt ...
-1
votes
0
answers
35
views
How to set Stop-Limit (STOP_LOSS_LIMIT and/or TAKE_PROFIT_LIMIT) orders in Binance API on futures trading?
I am building a future trading bot with python. I got an error
binance.exceptions.BinanceAPIException: APIError(code=-2021): Order would immediately trigger.
I am calculating the stop_loss and target ...
-1
votes
1
answer
32
views
Moving everage - how to calculate?
Please explain how to calculate the EMA indicator on trading candles?
I found the formula here:https://www.investopedia.com/ask/answers/122314/what-exponential-moving-average-ema-formula-and-how-ema-...
0
votes
1
answer
31
views
Get current price, pinescript v5
I'm trying to figure out how to call current price when a certain condition exists. For example:
if ta.crossover(short, long)
get.price(current) := someInteger
strategy.exit("closePosition&...
0
votes
1
answer
28
views
How to plot an indicator on top of another [Pine Script]
I need some help in pine script. In the charting we can plot multiple indicators on top of one another by Move to existing pane above or Move to existing pane below. Can we achieve this same ...
0
votes
0
answers
30
views
Strategy is not triggering any entry. Sell whenever price goes below first 15 min candle and exit with tiny profit. No stoploss
I am trying to back test a strategy-
Strategy -
wait for first 15 min candle to complete
If the price goes below 15 min candle then trigger sell entry immediately
Exit with tiny profit like 1 point. (...
0
votes
0
answers
28
views
Backtesting a volume weighted average price based trading system in TradingView (pinescript v5)
(my first post in stack overflow)
I am trying to compile my first bunch of code in an attempt to create a trading strategy based on volume weighted average price( (VWAP) trading.
So far i have:
//@...
0
votes
0
answers
14
views
How can I detect any change in Linear Regression Candle color from red to green or green to red after plotting them using plotcandle()
Assume lrcopen, lrchigh, lrclow, lrcclose are the open, high, low, close of Linear Regression Candle which is plotted using plotcandle(). I want to check and compare the lrcopen < lrcclose value ...
0
votes
0
answers
14
views
Indicator for tradingview
I would like to create an indicator on tradingview that returns the gap of an instrument that I am going to select, then I would like to compare it with the performance of the chart.
Within the ...
0
votes
0
answers
27
views
How to make sure alerts trigger in certain order in pine script strategies?
Using alerts that trigger with the same condition or on the same bar close seem to trigger in a random order each time. How can I specify that each alert has a specific order that alerts are triggered ...
0
votes
1
answer
22
views
Formatting error with pinescript strategy 'Mistmatched input 'strategy' expecting 'end of line without line continuation'
Hello I am trying to write a strategy where it buys when the MFI is oversold & the EMA is above 200. This code doesn't seem to wanna run. I keep getting an error saying "Line 2: mismatched ...
0
votes
0
answers
29
views
Polygon.io : Forex Quotes, timestamp and "next_url":"n_url" next GET issue using C#
The issue is when trying to http GET information from the FOREX historical tick data in polygon.io, from https://polygon.io/docs/forex/get_v3_quotes__fxticker it works by date using the following call....
1
vote
1
answer
40
views
Getting KeyError when implementing Turtle trading strategy with python
I am trying to implement the turtle trading strategy in Python, but I am getting a KeyError when I try to run the code. I have imported the necessary libraries and have the data in a DataFrame. I have ...
-1
votes
0
answers
25
views
MQL5 trading EA needs an expert eye
I'm trying to code a trading expert analyst and am running into some errors. I have limited coding knowledge, so I asked GPT to help me get started. The expert analyst is supposed to follow the rules ...
-1
votes
0
answers
33
views
How do I fix this single line of Pine Script? Error: Mismatched input '(' expecting ')'
strategy.exit("Sell", when = src cross sma20)
output:
Compilation error. Line 28: Mismatched input '(' expecting ')'
Please help me fix this, im just trying to get to a platform for a mean ...
0
votes
1
answer
44
views
Trouble getting ibapi to place trades
I am trying my hand at making my first algo-bot and decided to go with IB and use their api. I have followed Jacob Aramral's youtube series about making a bot and pretty much followed along and added ...
0
votes
0
answers
25
views
How to use Buy Stop Entries with the 'After Order is Filled' strategy parameter?
My strategy uses Buy Stops to enter a position, whereby it waits for a price target to be reached mid candle before taking an entry.
The strategy also has the "After Order is Filled" ...
-1
votes
1
answer
66
views
How to connect ccxt to java or kotlin, Or recommend a ccxt kind of library for java or kotlin
I need to connect to different crypto exchanges from java or kotlin, but most of the libraries I have found are for python or other languages, I would like to know how to connect ccxt to java or ...
0
votes
0
answers
25
views
I am trying to code a hedging EA on mql5 but some function is not working
`//so I am coding this EA on MQL5 and everything works fine until its time to to hedge. look at the //code
void onTick{
safetyBuy()
}
void safetyBuy(){
double openPrice;
int ...
1
vote
0
answers
26
views
Linear regression lines in a time series data(BTCUSD) with Angles close 90 degrees and slopes with big numbers
I trade Bitcoin and USD. For getting regression lines values, angles and slopes, I use the talib library.
I'd like to compare angle of regression lines of different lengths, for example regression ...
0
votes
0
answers
43
views
Total profit and loss calculation from option trading with options events with the Robinhood API data
I'm writing an Chrome extension to calculate total profit and loss from Robinhood trading history.
Found out that total profit/loss calculation for options trading is more complicated than what I ...
0
votes
0
answers
17
views
Why is this function causing a compiler error on trading view?
I'm not a huge fan of being told answers but can anyone please help me deduce what the problem here is? This is a function in a trading view library script and it results in an error at compile time ...
1
vote
1
answer
41
views
Quantconnect: Runtime Error: 'TSLA' wasn't found in the Slice object, likely because there was no-data at this moment
I'm trying to make a script that buy stocks if their price dip 5% in the last 5 minutes. Actually getting a runtime error when I try to run it on Quantconnect.
from AlgorithmImports import *
# ...
0
votes
0
answers
21
views
I am trying to write code which places a buy and a sell order at the pre-market high and low from the hour before the DAX open in pine script
Here is the code, I am new to coding so it may not be very correct or make a lot of sense. It compiles but I am having issues as the code still places orders after "0903"am, I only want ...
0
votes
1
answer
37
views
In Python, is there a way to use a for loop to perform a linear regression multiple times with different X and Y variables?
Essentially, I am trying to perform simple linear regressions on daily stock returns to figure out which stocks have the highest degree of mean reversion. My code pulls in S&P500 daily returns ...
0
votes
1
answer
59
views
How can i obtain the value of the body of a candle in Pinescript V5, i looked at the documentation and internet but all soultions offered are outdated
I would like to obtain the value BodyRange, to then input into strategy.entry in order to set a stoploss that would look something like this:
strategy.entry('Long', strategy.long, stop=body - stoploss,...
0
votes
1
answer
33
views
Issue in converting this tradingview pinescript from v2 to v5
I want to convert my script from v2 to v5 strategy and add Buy Sell Alerts. This script is working fine in v2, and I am able to see Buy/Sell Signals at screen, but also want alerts to pop up if any ...
0
votes
1
answer
409
views
how can i make the indicator nadaraya watson envelope output twice with different variables. It should be two upper borders and two lower borders
i want to run the nadaraya watson envelope twice but it should run in one indicator. Can someone tell me how to solve it?
so sieht der Quellcode von Nadaraya Watson Indicator
`
// This work is ...
0
votes
1
answer
46
views
My MA cross market entries in Pinescript V5 are generating when they should not be
I am starting to test a simple code in pinescript v5 which uses 2 moving averages to determine long and short trades. When backtesting it seems to work for the most part, however, I have noticed some ...
0
votes
0
answers
30
views
Calculated float price starting from MA indicator for VecotBT
Im trying to create a simple backtesting using VectorBT with Python. My workflow try to achieve the float price calculated on SMA indicator. So simply take my ponderation number, turn it into ...
0
votes
2
answers
53
views
How to solve the warning: "possible loss of data due to type conversion" in MQL5
I wrote this sample code for learning purposes but I can't seem to solve the warning message of "possible loss of data due to type conversion".
I have tried to search online but I can't seem ...
0
votes
0
answers
285
views
Any advice to fix "Compilation error. Script could not be translated from: |B|for i = 0 to "
I'm new to coding and wrote a script to test how many times the breakout of highs and lows that were created in the Asia Session happened during the London Session. However, it does not seem to work, ...
0
votes
0
answers
29
views
Why my MQL5 indicator is displaying one moving average instead of two?
I took the code of VIDYA from the examples library of MQL5 and added a second moving average to it; basically, another VIDYA line.
The newly created code is compiling without errors or warnings but ...
0
votes
1
answer
28
views
what is difference between sinput and input?
i wish you best.
what is actually difference between static input and normal input in MQL language? i mean sinput and sinput
in the book that i read written that:
"The value of a static input ...
0
votes
0
answers
19
views
Adding code to chart and getting an error `Compilation error.'`
I get an error when i try add this code to my chart
`
//@version=4
fastLength = 5
slowLength = 15
tradeAmount = 1
// Set up variables for the take profit and stop loss levels
takeProfit = 1.05 // ...