It's really interesting to see these platforms embrace Python.
What's the advantage I wonder ?
Python is the most complex way to code strategies. People say those services have advantages because they offer data. If one cannot afford to have data access for proprietary development then better not trade at all.
Anyone here who claims python is for trading system development please submit your code for a n-day channel breakout with trailing stop exit. It should be fun.
. It doesn't have a trailing stop as its a continous signal but that would be easy to do with rolling min and max. import pandas as pd
def blackadder(idx, x, max_x, min_x):
r_px=x[idx]
r_min=min_x[idx]
r_max=max_x[idx]
return 4*(r_px - mean([r_min, r_max]))/(r_max - r_min)
def baldrick(x, ws):
max_x=pd.rolling_max(x, ws, min_periods=min(len(x),int(ws/2)))
min_x=pd.rolling_min(x, ws, min_periods=min(len(x), int(ws/2)))
## Probably an easier way to do this by overloading the rolling function in pandas, but I haven't got time to check
sig=[blackadder(idx, x, max_x, min_x) for idx in range(len(x.index))]
sig=pd.TimeSeries(sig, index=x.index)
## smooth is optional to reduce non alpha noise
sig=pd.ewma(sig, span=int(ws/4.0), min_periods=int(ws/8.0))
return sig
If one cannot afford to have data access for proprietary development then better not trade at all.

Not sure exactly what you are trying to prove??

Not sure what data services and python have to do with each other. This is my breakout / channel signal literally cut and paste (I've only taken out some diagnostics). It might not be exactly what you want (it doesn't give a binary exit) but I'm sure you can work out how to modify it. It doesn't have a trailing stop as its a continous signal but that would be easy to do with rolling min and max.
Code:import pandas as pd def blackadder(idx, x, max_x, min_x): r_px=x[idx] r_min=min_x[idx] r_max=max_x[idx] return 4*(r_px - mean([r_min, r_max]))/(r_max - r_min) def baldrick(x, ws): max_x=pd.rolling_max(x, ws, min_periods=min(len(x),int(ws/2))) min_x=pd.rolling_min(x, ws, min_periods=min(len(x), int(ws/2))) ## Probably an easier way to do this by overloading the rolling function in pandas, but I haven't got time to check sig=[blackadder(idx, x, max_x, min_x) for idx in range(len(x.index))] sig=pd.TimeSeries(sig, index=x.index) ## smooth is optional to reduce non alpha noise sig=pd.ewma(sig, span=int(ws/4.0), min_periods=int(ws/8.0)) return sig
Not sure exactly what you are trying to prove??
"But oh, I almost forgot, you put all those on ignore that disagree or challenge you."The only troll I see here is you, you keep on posting obscure code (your coding skills still are mediocre at best) and dive into unrelated topics. "Stirring the pot" was a good expression by VPhantom to describe your attitude here. I have kind of lost touch with your actual point you try to make.
So, I still wait for a satisfactory answer in the same way "syswizard" does: Why would you want to use Python for this? Python and R in finance space are perfect to perform research and time series analysis, not to implement a trading architecture. But oh, I almost forgot, you put all those on ignore that disagree or challenge you.
"But oh, I almost forgot, you put all those on ignore that disagree or challenge you."
is that not the kettle calling the pan black.
oh i forgot you only do it to posters who definitively prove you wrong. how are your phantom stock HK traders doing, the ones who are pulling out of the market 1/2 per cent daily on their capital in spite of a stamp tax of .005