-
senooo说:
写个python程序实现画个鸟
import turtle turtle.setup(400,500) turtle.penup() turtle.fd(-250) turtle.pendown() turtle.pensize(25) turtle.pencolor("purple") turtle.seth(-40) for i in range(4): turtle.circle(40,80) turtle.circle(-40,80) turtle.circle(40,80/2) turtle.fd(40) turtle.circle(16,180) turtle.fd(40*2/3) turtle.done()
-
guest说:
Create a Pine Script backtest for BTC/USD that will buy Bitcoin when price moves above the 50 EMA and sell when it goes below the 50 EMA. Set the stop loss at 2 times the average true range of the entry candle.
strategy("50 EMA BTC/USD", overlay=true)
longCondition = crossover(close, ema(close, 50))
shortCondition = crossunder(close, ema(close, 50))//Buy when price crosses above 50 EMA
if longCondition
longEntryPrice = close
strategy.entry("Long", strategy.long)//Sell when price crosses below 50 EMA
if shortCondition
strategy.entry("Short", strategy.short)//Set stop loss at 2x ATR of entry candle
stopLoss = entryPrice - (atr(14) * 2)
strategy.close("Long", stop=stopLoss)
strategy.close("Short", stop=stopLoss)