Firetron's Spot DCA
stableDescription
Basic dollar cost averaging strategy.
Buys on Main Interval and sells on Profit Trigger.
HaasScript
-- ============================================================================
-- Firetron's Spot DCA
--
-- Basic dollar cost averaging strategy.
-- Buys on Main Interval and sells on Profit Trigger.
--
-- Discord: @FiretronP75
-- ============================================================================
-- ========================================================
-- Configuration
-- ========================================================
EnableHighSpeedUpdates()
-- ========================================================
-- Variables
-- ========================================================
local logHRule = '------------------------------------------------------------';
-- ========================================================
-- Inputs
-- ========================================================
local group = 'Script Settings'
local label = 'Profit Trigger'
local tooltip = 'Percent profit that will trigger a sell.'
local profitTrigger = Input(label, 10, tooltip, group)
-- ========================================================
-- Functions
-- ========================================================
function Buy ()
Log(logHRule)
PlaceBuyOrder(CurrentPrice(), TradeAmount())
end
-- ----------------
function Sell ()
if TakeProfit(profitTrigger) then
Log(logHRule)
LogWarning('Selling.')
PlaceSellOrder(CurrentPrice(), GetPositionAmount())
end
end
-- ========================================================
-- Execution
-- ========================================================
Sell()
OptimizedForInterval(0, Buy)
0 Comments
Sign in to leave a comment.
No comments yet. Be the first!