Untitled
unknown
plain_text
4 months ago
8.2 kB
4
Indexable
showShortPosition = input(false, "⭕ Short Position ", tooltip = "Seçim yapılırsa Çift Yönlü işlem açılır.", inline = "tableShow") showQuantityTable = input(true, "💰 Kazanç Tablosu ", inline = "tableShow" , tooltip = "\nShort Position : \nSeçim yapılırsa Çift Yönlü işlem açılır. \n\nKazanç Tablosu: \nSeçim yapılırsa Kazanç Tablosunu aktif eder.\n\n") jSonLOG = input(false, "JSON Order Log", inline = "tableShow" , tooltip = "\nShort Position : \nSeçim yapılırsa Çift Yönlü işlem açılır. \n\nKazanç Tablosu: \nSeçim yapılırsa Kazanç Tablosunu aktif eder.\n\nJSON Order Log :\nSeçildiğinde Al Sat emirlerini loglar") // quantity = input.float(1, title= "📑 Emir Tutarı & Miktarı " , group=strParamsGroupName , minval=1 , inline = "quantitiyGroup" , display = display.none) // quantityAmaount = input(false, "Tutarla AL", tooltip = "İşaretlenirse Emir Miktarı bölümüne yazılacak rakama göre Lot hesaplanıp emir gönderilir.", group=strParamsGroupName , inline = "quantitiyGroup" , display = display.none) TP1Selected = input(false, "" , group=strParamsGroupName , inline = "TP1" , display = display.none) longTP1 = input.float(2 , title='Kâr Al % ' , step=0.1 , group=strParamsGroupName , inline = "TP1" , display = display.none) / 100 longTP1Qty = input.int(10 , title=' Kâr Al Positon % ' , step = 1 , group=strParamsGroupName , inline = "TP1" , display = display.none , tooltip = "\nKâr Al % :\nGirilen değer %'si kadar yukarı Kâr Alım satışı yapar.\nKâr Al Positon % :\nGirilen değer %si kadar Portföy üzerinden Kâr satışı yapar.\n\nGirilen bilgilere göre Kâr Satışları yapılır.\n") TP2Selected = input(false, "" , group=strParamsGroupName , inline = "TP2" , display = display.none) longTP2 = input.float(5 , title='Kâr Al % ' , step=0.1 , group=strParamsGroupName , inline = "TP2" , display = display.none) / 100 longTP2Qty = input.int(20 , title=' Kâr Al Positon % ' , step = 1 , group=strParamsGroupName , inline = "TP2" , display = display.none , tooltip = "\nKâr Al % :\nGirilen değer %'si kadar yukarı Kâr Alım satışı yapar.\nKâr Al Positon % :\nGirilen değer %si kadar Portföy üzerinden Kâr satışı yapar.\n\nGirilen bilgilere göre Kâr Satışları yapılır.\n") TP3Selected = input(false , "" , group=strParamsGroupName , inline = "TP3" , display = display.none) longTP3 = input.float(7 , title='Kâr Al % ' , step=0.1 , group=strParamsGroupName , inline = "TP3" , display = display.none) / 100 longTP3Qty = input.int(100 , title=' Kâr Al Positon % ' , step = 1 , group=strParamsGroupName , inline = "TP3" , display = display.none , tooltip = "\nKâr Al % :\nGirilen değer %'si kadar yukarı Kâr Alım satışı yapar.\nKâr Al Positon % :\nGirilen değer %si kadar Portföy üzerinden Kâr satışı yapar.\n\nGirilen bilgilere göre Kâr Satışları yapılır.\n") apiKey = input.string("APIKEYaRmDLKxMv7h2P_sTE4TZEAqLRdYYWdYAKAcP0Lk3LTdixOAZ0DFGhoYVkhas5am2", title=" 📏 API Key " , group = indicatorGroupName , display = display.none , inline = "COMRSI1" , tooltip = "APIKEY bilgisinin doğru ve eksiksiz olduğuna emin olunuz.Aksi taktirde emirleriniz aracı kuruma GÖNDERİLEMEYECEKTİR.") symbol = "{{ticker}}" // Bu sabit bir değer olarak bırakılmıştır. TradingView'da otomatik olarak sembol bilgisi alınabilir. messageTimenow = "{{timenow}}" // Bu sabit bir değer olarak bırakılmıştır. TradingView'da otomatik olarak zaman bilgisi alınabilir. // Tutarla alım durumuna göre Lot hesaplaması yapılır. // if(quantityAmaount and quantity > 0) // orderQuantity := quantity / close // orderQuantity := math.floor(orderQuantity) // else // orderQuantity := quantity var string longMessage = "" var string shortMessage = "" // Alarm mesajları shortMessage := '{"name": "' + syminfo.ticker + '", "symbol": "' + syminfo.ticker + '", "orderSide": "sell", "orderType": "mkt", "price": "0", "quantity": "' + str.tostring(strategy.position_size) + '", "timeInForce": "ioc", "apiKey": "' + apiKey + '", "timenow": "' + messageTimenow + '"}' var float first_buy_price = na var int barIndex = -2 if str.length(apiKey) < 1 log.error("Api Key boş olamaz") var float longTP1Level = 0 var float longTP2Level = 0 var float longTP3Level = 0 // Strateji giriş ve çıkışları if bullishCross and inDateRange defatultEntryQty = strategy.default_entry_qty(open) log.info("Fiyat : {0} Quantity : {1}", open, math.floor(defatultEntryQty)) longMessage := '{"name": "' + syminfo.ticker + '", "symbol": "' + syminfo.ticker + '", "orderSide": "buy", "orderType": "mkt", "price": "0", "quantity": "' + str.tostring(math.floor(defatultEntryQty)) + '", "timeInForce": "ioc", "apiKey": "' + apiKey + '", "timenow": "' + messageTimenow + '"}' strategy.entry("Buy", strategy.long, qty = math.floor(defatultEntryQty), alert_message = longMessage) alert(longMessage, alert.freq_once_per_bar_close) if (na(first_buy_price)) // Eğer ilk alım fiyatı daha önce atanmadıysa first_buy_price := open barIndex := bar_index log.info("Sinyal Bar Index : " + str.tostring(bar_index) + "Sinyal Open : " + str.tostring(open)) if jSonLOG log.info("Buy Signal - JSON Data :\n{0}", longMessage) if TP1Selected longTP1Level := open * (1 + longTP1) strategy.exit('TP1 (%' + str.tostring(longTP1 * 100) + ')', 'Buy', qty_percent = longTP1Qty, limit = longTP1Level) if TP2Selected longTP2Level := open * (1 + longTP2) strategy.exit('TP2 (%' + str.tostring(longTP2 * 100) + ')', 'Buy', qty_percent = longTP2Qty, limit = longTP2Level) if TP3Selected longTP3Level := open * (1 + longTP3) strategy.exit('TP3 (%' + str.tostring(longTP3 * 100) + ')', 'Buy', qty_percent = longTP3Qty, limit = longTP3Level) if selectedStrategy == strategys.RsiMumBar var float sellPercentage = 0.0 if (strategy.opentrades > 0) entryPrice = strategy.position_avg_price currentPrice = close priceDifference = currentPrice - entryPrice // Convert price difference to a percentage relative to the current price sellPercentage := priceDifference / currentPrice * 100 sellPercentage := math.max(sellPercentage, 1) // Ensure it's at least 1 // log.info("selectedStrategy : {0} enableTakeProfitRSI : {1} takeProfitCondition : {2} ", str.tostring(selectedStrategy), enableTakeProfitRSI, takeProfitCondition) if (takeProfitCondition) strategy.close("Buy", qty_percent = sellPercentage) if bar_index == barIndex +1 first_buy_price := open log.info("Hespala Bar Index : " + str.tostring(bar_index) + "Open : " + str.tostring(open)) if (bearishCross and inDateRange and showShortPosition != true) strategy.close("Buy", alert_message = shortMessage) alert(shortMessage, alert.freq_once_per_bar_close) if jSonLOG log.warning("Sell Signal - JSON Data :\n{0}", shortMessage) if (bearishCross and inDateRange and showShortPosition == true) strategy.entry("Sell", strategy.short, alert_message = shortMessage) alert(shortMessage, alert.freq_once_per_bar_close) if jSonLOG log.warning("Sell Signal - JSON Data :\n{0}", shortMessage)
Editor is loading...
Leave a Comment