INNER CODE UNIT · Python

get_sl

Mo-Khalifa96/Forex-Trading-Bot · OrderProcessing.py:25

def get_sl(entry, tp):
    '''
    This function calculates the stop loss value based on a risk-to-reward ratio (RRR) of 1.2\n
   
    Args:
        - entry: The trade entry price.
        - tp: take profit.
    '''

    return (entry - ((tp-entry)/1.2))


def Buy_req(symbol, entryp, min_val, avg_val):
    '''This function creates and returns a buy request.'''

    #Get lot amount 
    lot = get_lot(mt5.account_info()._asdict()['balance'])
    #Double the lot if price is closer to the average line

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…