RicardoLibrary
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © costatrindade01

//@version=5

// @description Ricardo's personal Library 
library("RicardoLibrary")

// @function GetPipValue
// @returns Pip value of Symbol
export GetPipValue() =>
    Currency = syminfo.currency
    PipValue = Currency == "JPY" ? 0.01 : 0.0001
    PipValue

// @function Calculate_SL: Calcultes Stop Loss
// @param IsLong If true, then I am going to enter a long position, if false then Short position
// @returns Stop loss Price
export Calculate_SL(bool IsLong, float Pips) =>

    sl_price = 0.0
    
    if IsLong == true
        sl_price := close - Pips * GetPipValue()
        
    if IsLong == false
        sl_price := close + Pips * GetPipValue()
        
    sl_price
    

