[CMD] Weighted Slot Spread – Price and Amount

1 671 Views No Comments 3 years ago
  • Weighted amount adjusted over spread, increasing, decreasing or flat. Additional Option to use ATR instead of percent input.

    Returns an array to use in for each slot/order spreads – keys – price and amount.

    
    --- example
    isLong = true --- above/below calc 
    slotSize = 10--- the total slot size to be distributed 
    slotCount = 15-- the number of slots 
    price = CurrentPrice().bid --- The price to start from
    dist = 1 ---  -1 Decreating, 0 Flat, 1 Increasing 
    slotSpread = 0.2
    atrspr = false
    slotCancel  = 0.7
    
     local weights = CC_WeightedSpread(isLong, slotSize, slotCount, price, dist, slotSpread, atrspr) 
              for i = 1, slotCount do
                      slot(true, i, weights.amount[i], weights.price[i], slotCancel) 
              end
    
    Log(weights.price) 
    Log(weights.amount)
    
    

    41. 10 Jun 2021 18:31:30 [0.295, 0.339, 0.430, 0.439, 0.556, 0.556, 0.562, 0.566, 0.576, 0.619, 0.619, 0.621, 0.670, 0.678, 0.769, 0.774, 0.843, 0.846, 0.855, 0.919, 0.960, 0.967, 0.987, 0.988, 1.0, 1.001, 1.095, 1.096, 1.101, 1.127, 1.136, 1.240, 1.290, 1.336]40.

    10 Jun 2021 18:31:30 [59.667426, 59.548, 59.429, 59.309, 59.190, 59.071, 58.951, 58.832, 58.713, 58.593, 58.474, 58.355, 58.235, 58.116, 57.997, 57.877, 57.758, 57.639, 57.519, 57.400, 57.281, 57.161, 57.042, 56.923, 56.803, 56.684, 56.565, 56.445, 56.326, 56.207, 56.087, 55.968, 55.849, 55.610041032]

    ****Note the lines plotting the spread in the image are not part of this command

    HaasScript Code
    Sign in or Register to download for free
Login or Register to Comment

Unlock your crypto trading potential

Create a free account and enjoy everything we have to offer.

Join for Free